For anyone confused how math.floor(x * 10^n) / (10^n)
actually works here is an explanation.
The x * 10^n
is meant to shift x
by n
places. So if you have the number 10.25
and multiply by 10^2
which is 100
that leaves you with 1025
. Given this logic you could now floor the number which will cut off the remaining decimal portion if there was any and then divide by the original 10^n
because you want to put your number back to the same significant figures.