C why is the DBL_MANT_DIG macro defined as 53 [duplicate]
I want to know why DBL_MANT_DIG is set to 53, even though the ieee 754 standard uses 52 mantissa bits. Is it counting the sign bit as well?
In fact the binary IEE 754 representation includes a hidden bit: the leading bit of the mantissa is required to be 1 for normal numbers and because of that it has not to be stored. So the mantissa is in fact that leading 1 bit plus the 52 other bits which gives... 53
References from Wikipedia (emphasize mine):
For numbers with an exponent in the normal range (the exponent field being neither all ones nor all zeros), the leading bit of the significand will always be 1. Consequently, a leading 1 can be implied rather than explicitly present in the memory encoding, and under the standard the explicitly represented part of the significand will lie between 0 and 1. This rule is called leading bit convention, implicit bit convention, or hidden bit convention. This rule allows the binary format to have an extra bit of precision.