39

If all bits are 0 (example I memset the floating point variable to all 0), what is the value of IEEE floating point used in gcc? It is guaranteed to be 0.0 ?

I guess for other floating point formats result may vary. But my question is specific to IEEE floating point used with gcc.

Lunar Mushrooms
  • 8,358
  • 18
  • 66
  • 88

1 Answers1

49

If the implementation is IEEE 754 compliant there exist special cases for different bit-combinations, like documented here.

For your case: When all bits (sign, exponent, mantissa) are zero the floating point value represents also zero, as defined by IEEE 754. More specifically, that value is a "positive zero", also written as +0.

cubuspl42
  • 7,833
  • 4
  • 41
  • 65
Sebastian
  • 8,046
  • 2
  • 34
  • 58