lua-users home
lua-l archive

math.floor and rounding

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,
I want to round numbers with two decimal digits.
I use math.floor( n * 100 ) but sometimes I have situations like:
n = 10.20
math.floor( n * 100 ) --> 1019
My current solution is to always add 0.001 to n, but is this the right
approach ?
thanks

AltStyle によって変換されたページ (->オリジナル) /