Re:GCC Non-bugs
by shortstuffsushi on Monday March 02, 2015 @11:59AM
(#9132854)
I realize that 1/3 is not terminating in decimal, what I meant was that in JS, it seemed to end neatly after x decimal places, which I found interesting. I hadn't tried the operation you mentioned until you posted that, the results are even more bizarre to me. Seems I need to spend some time relearning floating point math to better understand what I'm seeing.
So you're telling me we should use base 3.
Re:GCC Non-bugs
by jakobegger on Monday March 02, 2015 @03:29AM
(#9130909)
Well then 0.5 would be non-terminating...
The statement that "1/3 is terminating" is not true in binary, it is not true in decimal, and the only reason that you sometimes get the expected results is that sometimes the rounding errors will cancel out.