2^0 is 1, so if the exponent is 0 then the mantissa times one is your value, so every integer has an exact representation.<p>If the exponent is 1, then the mantissa is multiplied by 2 to get the actual value. Put another way, the mantissa is the value divided by 2 and rounded, i.e. shifted right one bit.<p>&gt; 1x10^7 + 2x10^7 != 3x10^7, right?<p>This particular case is interesting.<p>If we&#x27;re talking about 64-bit doubles, then you have 53 bits of precision for integers. All those values are <i>well</i> within that range, so this arithmetic and comparison are done with precise integer values, and the expression will compare equal.<p>If we&#x27;re talking about 32-bit floats, the range of precise integer values is -16,777,216 through 16,777,216, or -2^24 through 2^24.<p>1x10^7 is 10,000,000, within that range, but the other two values are outside the range.<p>So you might expect that != would be the answer here.<p>But if you test it, that isn&#x27;t the case: the expression compares equal!<p>The reason: although 20,000,000 and 30,000,000 are outside the range where <i>every</i> integer has a precise representation, they are within the range where every <i>even</i> integer is precise: -33,554,432 to 33,554,432. Values within this range but outside the range of precise integers are rounded to a multiple of 2.<p>Similarly in the range -67,108,864 to 67,108,864, all integers which are a multiple of 4 are represented precisely.<p>Basically, as you go outside the range of precise integers, values get rounded to a multiple of 2, 4, 8, etc. as required.<p>When the mantissa overflows the available precision, it is shifted to the right enough so that it fits without losing the most significant bits. Instead, the least significant bits are discarded, and the exponent is incremented by the number of discarded bits.<p>Of course you could choose other values where the rounding doesn&#x27;t work out in your favor, and then you&#x27;d get the unequal comparison you expect. A simple example:<p>33333333.0f + 1.0f != 33333334.0f<p>Here, the value 33,333,333 is rounded down to 33,333,332. Add 1 to that and you get 33,333,333, which is again rounded down to 33,333,332.<p>33,333,334 <i>is</i> represented precisely, so the comparison fails.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Single-precision_floating-point_format#Precision_limitations_on_integer_values" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Single-precision_floating-poin...</a>