Officially goin out of my mind. Trivial INT problem
#5
Here's the problem, @bert22306 :

Code: (Select All)
x = 35.51
y = x * 100
z = Int(y)
Print Using "######.##############"; x
Print Using "######.##############"; y
Print Using "######.##############"; z

Remember, PRINT rounds and truncates and only displays a maximum of 8 digits or so of your number -- which is why the results format to look like what you'd exoect. PRINT USING, as above, gives you a much more accurate depiction of what the true values of your variables are.

35.51 has no perfect representation in binary math. Multiplying an imperfect representation leads to another imperfect representation.

Everything is working 100% as expected here, even if PRINT, by itself, makes that a little difficult to see and understand.
Reply


Messages In This Thread
RE: Officially goin out of my mind. Trivial INT problem - by SMcNeill - 10-31-2022, 08:19 AM



Users browsing this thread: 7 Guest(s)