I'm aware that Solidity doesn't support double and floating values.
I'd like to know if there's any way, in Solidity, to get the floor of a division, like: floor(x/2), where x can be any arbitrary "uint" value? so we can get: floor(5/2)=2;
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
Solidity uses integer division, which is equivalent to floored division.
5/2 == 2
Note: Workaround for integer literals feature of solidity
You can try
uint b = uint(5)/2;
Solidity is trying to help you to not make mistakes.