Skip to content
Prev 58887 / 398502 Next

wrong answer for simple expressions

Drew Hoysak <dhoysak at ccs.carleton.ca> writes:
Welcome to the world of floating point arithmetic! Since one tenth
cannot be represented exactly in binary, you are going to see these
small deviations once in a while. It is is really no stranger than 

   3/3 - (1/3 + 1/3 + 1/3) = 1.000 -  (0.333 + 0.333 + 0.333) = 0.001

in decimal notaion.