float multiply error 900,000,000 * 10 = 8,999,999,488

Hey,

When I multyply the float 900,000,000 by 10 (just an example I need more calculations like this because my game has very high gold values)
I get 8,999,999,488 instead of 9,000,000,000 why is that so and is there an fix/workaround for this?

With smaler numbers I don’t have this error I thought maybe it’s just to big of a number for float but I can go up too 340282346638528859811704183484516925440 when I tryed unseing the biggest float possible.

This is quite odd, I have no idea why it does this but i can replicate it on my project. I also tried just adding 900,000,000 ten times while printing and between 36 and 45, it randomly drops by 256 and seems to continue that trend. not really sure how to get around it either.

You may be running into floating point prescision issues.
Why are you using floats instead of a integer?

HTH

A signed 32-bit integer can have a maximum value of 2^31 − 1 = 2,147,483,647.

Your numbers go above… and … well… strange stuff happens.

If you go into C++ I think you could get away with using 64 bit numbers for your crazy stuff.

Actually… your number is off by exactly 512.
So you’re basically pushing out the last 9 bits to reach your number, and they are just assumed to be 0

This is normal. Here is why: Floating Point Numbers - Computerphile - YouTube
You probably exceed precision points. It is weird that blueprints have such bad precision (I replicated same stuff here).
But you can make your own struct to store very large numbers. And print them (or change to string).

Or make what first mmo ever (which is WOW) did: store currency as platinum gold silver and copper. But that is quite similar to my above idea of splitting long numbers.

You can always make those nodes (and gold storing variable) in C++

This is basic float math here. 900,000,000*10= 9,000,000,000 = 9.000,000,000 * 10^9.
For this number you need 10 digits of accuracy, while float tops out between 6 and 7. Even 900,000,000 is out of range. * Store that as a float and print it to screen a bunch of times. *(I guess it can handle 900m as a user input correctly odly enough, but it cannot handle 900,000,001 for example.)

You should be using INT based variables for gold like currency.