• ### 1 - 0.99 = 0.0999999?

Using a number-box to put 0.99 into a [swap 1]->[- ] outputs 0.00999999 instead of 0.01. Anyone know why this is? I've expanded the number-box to make sure it doesn't have any decimal values beyond the 100ths place. Oddly, 0.98 gives back 0.02 normally.

I've just tried putting a message [1 (->[- 0.99] and this also gives back 0.00999999. Tried it without any number-boxes, putting a [print] at the output and the result is the same.

• Posts 4 | Views 2210
• @s.elliot.perez It has been discussed before either here or on the list but I can't find it straight away.
If you have a few weeks free there is discussion about numbers, calculation, and why the answer is not wrong here........ https://en.wikipedia.org/wiki/Talk%3A0.999.../Arguments
David.

• @whale-av Ah, OK. Just wanted to make sure it wasn't a bug with my computer or something. I'll hold off on the weeks of study for now though. Thanks!

• @s.elliot.perez it has to do with the internal representation of floating-point binary numbers: both base-10 decimal numbers have to be converted into binary floating point, and then the operation takes place. (If you looked at the numbers in binary representation the result would probably make more sense)
edit: here you can see that when you type .99 it actually gets represented as
0.9900000095367431640625
http://www.binaryconvert.com/result_float.html?decimal=048046057057

Posts 4 | Views 2210
Internal error.

Oops! Looks like something went wrong!