Improper value rounding

This is extremely annoying and makes me unable to use direct numbers when dealing with these.

I entered in 0.235. I got this. [spoiler]

[/spoiler]

Floating Point Numbers – easier for the computer to store, so that’s what it uses.

EDIT: If this is seriously impacting you:

A ) Rescript – this shouldn’t be seriously impacting you
B ) Make a rounding function and round the number to x number of decimal places.

This can cause issues if you need to check what the value is and you don’t want to make an if statement looking for something that is larger than a tiny bit smaller and smaller than a tiny bit larger.

Or you could subtract the floating point number from the direct number and find if the absolute value is within a tiny amount. If you need to have an if statement check for the value.

Quite literally all you’d have to do is run the value through a rounding function.

“Rounding” will not solve the issue.

The output is simply showing you what is really being store internally. Whether you like it or not, the floating point format can’t exactly store the number 0.235, regardless of how much “rounding” you do to it.

Now, you can format the number differently when you output it, however, that won’t change the fact that the number is actually that long form internally.

There’s a difficult argument here on what should be displayed: Should studio “lie” to you, and show you the “rounded” formatted form of the real value, or should it show you the real value in all it’s expanded ugliness? Depending on who you are your answer may vary, and Roblox Studio isn’t exactly consistent on which form should be shown, but there is an issue there that there is no real right answer to.

If you’re worrying about comparisons not working as intended, don’t fear!