I’m wondering if it is possible to only keep 1 decimal of a number without rounding them. For exapmle:
1.678 → 1.6
1.81 → 1.8
6.89 → 6.8
Please let me know if you have a solution.
1 Like
math.floor(yourNumber* 10) / 10
3 Likes
I can’t belive I didn’t think of that. Thanks for the solution.
1 Like
to add onto that:
-- The "Inverse"
math.floor(x / .1) *.1
-- Like the Solution above, its still Rounding, all you are doing is having the
-- number be 1 digit higher than it should, and then dividing it back to normal
-- string.format
string.format("%.1f", x)
tostring(x):format("%.1f")
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.