You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With round() you can pick the number of digits after the decimal to round to, i.e. round(x, 2) to round to the nearest hundredth.
But floor() and ceiling() only work for going to an integer, not tenths or hundredths, etc.
They could use a similar optional second parameter like Round() has, that does the same thing.
i.e. while round(1.666, 2) would give 1.67, floor(1.666, 2) would give 1.66.
Without that, people have to resort to the workaround of multiplying by a power of ten to shift the decimal point, then calling floor() then shifting it back, like so:
to get the effect of floor(x, 2) the script has to do: floor(x*100) / 100.
The text was updated successfully, but these errors were encountered:
With
round()
you can pick the number of digits after the decimal to round to, i.e.round(x, 2)
to round to the nearest hundredth.But floor() and ceiling() only work for going to an integer, not tenths or hundredths, etc.
They could use a similar optional second parameter like Round() has, that does the same thing.
i.e. while
round(1.666, 2)
would give 1.67,floor(1.666, 2)
would give 1.66.Without that, people have to resort to the workaround of multiplying by a power of ten to shift the decimal point, then calling floor() then shifting it back, like so:
to get the effect of
floor(x, 2)
the script has to do:floor(x*100) / 100
.The text was updated successfully, but these errors were encountered: