5 ms·
Pretty cool. Can we use WolframAlpha to show why 0.1 cannot be represented as a floating binary? And why floating numbers shouldn't be used for currency opera
by huherto 13y ago
Pretty cool.
Can we use WolframAlpha to show why 0.1 cannot be represented as a floating binary?
And why floating numbers shouldn't be used for currency operations.
- al2o3cr 13y agoYes. http://www.wolframalpha.com/input/?i=1%2F10+in+base+2 http://www.wolframalpha.com/input/?i=1%2F10+in+base+2 TL;DR: 1/10 has an infinite repeating binary expansion. (think 1/3 in decimal - 0.3333333) The part that really gets you into trouble is that the repeating pattern is 0011, which means it rounds differently depending on how many digits of precision you give it.