At 10:31 AM -0700 4/24/99, Michael S. Davis wrote:
>I have looked at NewFloatMgr and it shows a double as:
>
>Nibble Positions:
> 12 34 56 78 etc
>0x80 00 00 00 0x00 00 00 00 sign
>0x7F F0 00 00 0x00 00 00 00 exp offset by 1023
>0x00 0F FF FF 0xFF FF FF FF significand with implied 1
This is correct.
>So, I would expect the significand for a double to change
>nibbles 4,5,6,7,8,etc (as shown above).
Not always, since the number is represented as 1.significand * 2^exp.
>I saved the following doubles and looked at the raw data
>and it did not seem to match the above format. Keep in
>mind that uses these numbers produce the correct results
>so I know they are stored correctly as doubles.
>
>1 0x3F F0 00 00 0x00 00 00 00
>2 0x40 00 00 00 0x00 00 00 00
>3 0x40 08 00 00 0x00 00 00 00
>4 0x40 10 00 00 0x00 00 00 00
>5 0x40 14 00 00 0x00 00 00 00
>8 0x40 20 00 00 0x00 00 00 00
>123 0x40 5E C0 00 0x00 00 00 00
>
>So, how is it that if sign is in nibble 1 and exp is
>in nibble 1,2,3 that the significand also uses nibble
>2,3,4,5,6,etc. It seems that there is some overlap
>of significand and the exp nibbles (2). And I know this
>cannot be the case.
Look at the values for 1, 2, 4, and 8 (all exact powers of two). The
"implied 1" in the significand is left of the decimal point, and the
expressed significand is the fractional part - right of the decimal.
Hence, for 1, 2, 4, and 8, the significant is always 1.0, base two,
with exponent values of 0x3FF, 0x400, 0x401, and 0x402. Subtract
0x3FF from each, and you get 1.0 x 2^0 = 1, 1.0 x 2^1 = 2, 1.0 x 2^2
= 4, and 1.0 x 2^3 = 8.
As for 3, 5, and 123, these are fractional values, where the
significand is non-zero, but still appears to the right of the
decimal. In binary form, 3 is represented as 1.1 (base 2) x
2^(0x400-0x3FF) or (1 + 1/2) x 2^1 or 1.5 x 2.
Hope this helps.
--Steve