Does SafeMath handle rounding errors?

I would like to know if I can rely on SafeMath to handle rounding errors.

Example;

amount 100
filled 25
ratio amount/filled 0,25
amount - ( amount * ratio/100) 99,75

Will this kind of behavior happen with SafeMath?
Do I have to deal with odds division

1 Like

Hi there!

SafeMath does not handle rounding. In any division which has a fractional result, it will round down to the nearest number.

In your example, calculating ratio = 25 / 100 will result in 0

3 Likes