c++ - Is floating point multiplication by zero guaranteed to produce zero? -
i understand floating point has rounding errors, i'm wondering if there situations error not apply, such multiplication 0 .
does 0 times number = 0 floating points ?
false:
0f * nan == nan 0f * infinity == nan and ...
0f * -1f == -0f (negative 0f), 0f == -0f :-) (on intel, vc++, , on platform uses ieee 754-1985 floating points)
example on ideone (that uses gcc on intel compatible platform probably)
Comments
Post a Comment