66
Floating point Maths
(programming.dev)
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
The example is wrong, because they used
1.0.But in general
x-xdoes not have to equal0, that is true. I'm pretty sureNanandinfinitywould yield not0.0, butNaninstead.And if you reach x with two different calculations, e.g.
x1 = a - b - candx2 = a - c - bit is certainly not guaranteed thatx1 - x2 == 0.0This is correct. Additionally, if x is NaN, then x ≠ x.