Verified:

Xinhuan Game profile

Member
3728

Dec 16th 2013, 11:52:10

Originally posted by crest23:
Please explain that again, but this time, use the actual number, 4100000. Not 4.1, lol.


I can't do that, because the user explicitly typed in "4.1m" in the textbox, which means the number that the computer has to interpret is "4.1", followed by a "m".

Because of the way computers store numbers, 4.1 is really stored as 4.09999999999999964472863211995. After multiplying by 1m and rounding down the result of the multiplication _towards_ 0, this becomes a final value of 4099999.

Is this now simple enough to understand? Basically, numbers with decimal parts cannot be stored _exactly_, unless it can be decomposed and added up by fractional powers of 2. (i.e, 0.5, 0.25, 0.125, etc).