News for hackers. Stuff that matters.
Re:0.30000000000000004 by StefanKarpinski on Friday November 13, 2015 @11:48AM (#10560778)
Spot on. I would add to this explanation that the real confusion comes from the fact that in most languages when you write `0.1`, it doesn't mean 0.1 = 1/10 – instead it means the closest number to 0.1 of the form n/2^k where n < 2^53. Namely 0.1000000000000000055511151231257827021181583404541015625, which we can represent in decimal because 2 divides 10. And, of course, the illusion that `0.1` is actually 0.1 is supported by the great efforts [1] made to print floating-point values with the least number of digits necessary to reproduce them, so `0.1` still looks like 0.1 when you print it even though it isn't.

[1] http://www.cs.tufts.edu/~nr/cs257/archive/florian-loitsch/pr...

Re:0.30000000000000004 by fryguy on Friday November 13, 2015 @01:17PM (#10561356)
In decimal if you only have 5 digits for mantissa and you write 2/3, it becomes 0.66667 which is a little bit more than 2/3. Similarly, if you write the binary number 0.0000'0000'1 in decimal with 5 digits for mantissa, it becomes 0.0039063 instead of 0.00390625. If in some faraway land they use binary math, they would likely ask why such a simple binary number got rounded off.
Re:0.30000000000000004 by benten10 on Monday November 16, 2015 @08:22AM (#10574249)
Huhh, that was a totally unexpected encounter to Prof. Ramsey's page.