Numbers Turn Improper When Adding Small Numbers

I’m making a game and am using a variable for text, and while whole numbers work perfectly fine with ToString, decimals like 0.01 for example turn into numbers like “12.999…” and so on, this is very annoying, as you can imagine having “12.999…” in a text instead of 13 would be annoying, right?

In my game it costs coins to buy upgrades, the slot below it is the amount of speed your character has, as you can see it’s a very large number, in fact it doesn’t even fit in the text box.
It’s supposed to be 0.1, not 0.999… ect.

Hello, ValenCreates!

In an old thread about this a forum user gave an explanation that it is not a bug, but something related to how machines represent the numbers :thinking:: Plus/minus action with decimal numbers in variables

When I needed to solve this in my game, I used the expression “ceilTo”:

ceilTo(number, number) Round number up to the Nth decimal place

1 Like

What would the first and second number represent?

Here an user helped-me: [SOLVED] Decreasing decimal numbers causes inaccurate results

He said: ceilTo(value, decimal places)

1 Like

I’ll take a look, thanks for responding!

1 Like