Why doesn't my rounding work?

So I’m trying to make a number have to decimals insted of 1.33333333333, but it doesnt work can soemone please help me?

print(rollTime) -- prints 1.33333333333

rollTime *= 100
rollTime = math.floor(rollTime)
rollTime /= 100

print(rollTime) -- still prints 1.33333333333

can someone please help me with this?

rollTime = math.round(rolltime*100)/100

rollTime = math.round(1.33333333* 100) / 100
= math.round(133.3333333)/100
= 133/100
= 1.33

x-x%0.01 = a number truncated to the nearest hundredth

x is your number so for example 1.33333333333-1.33333333333%0.01 = 1.33

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.