What happens when for example I divide 10/3 it is rounded or what?
2 Likes
Yes, Solidity rounds towards zero.
Since the type of the result of an operation is always the type of one of the operands, division on integers always results in an integer. In Solidity, division rounds towards zero. This mean that
int256(-5) / int256(2) == int256(-2)
.
_From: https://docs.soliditylang.org/en/v0.8.1/types.html?highlight=division#division_
2 Likes