[SOLVED] Unity Rounds Numbers In Millions. How To Prevent It?

In my project, I may have some large numbers (in the millions and beyond). However, I can’t display the float of the number due to Unity automatically rounding the number if it exceeds 999,999. Is there a way to prevent Unity from rounding the numbers so I can properly display the decimal point?

Example:
4,537,132.4
I want that to show as is, with no rounding. But Unity rounds automatically:
4,537,132.0

Any help would be greatly appreciated!

– Chris

It’s because the float can only handle 7 digits of precision. https://msdn.microsoft.com/en-us/library/b1e65aza.aspx

You have 8, so you would need to use a “double” instead of float.
https://msdn.microsoft.com/en-us/library/678hzkk9.aspx

1 Like

Didn’t know that. Thanks for the help!

– Chris