GNU GCC does not round floating-point divisions to the nearest value

Posted on
news

GNU GCC does not round floating-point divisions to the nearest value

I know that floating-point arithmetic is a bit crazy on modern computers. For example, floating-point numbers are not associative: 0.1+(0.2+0.3) = =

0.599999999999999978 (0.1+0.2)+0.3 = = 0.600000000000000089

But, at least, this is fairly consistent in my experience. You should simply not assume fancy properties like associativity to work in the real world.

Source: lemire.me