On Fri, 27 Jun 2003 14:23:22 GMT, Jack Crenshaw <>
wrote:
>I've run across a peculiarity concerning the format used inside the
>Intel math coprocessor. I have always
>thought that the format used was in accordance with the IEEE 794
Unless IEEE 794 is something new, I think you mean IEEE 754.
>standard, and every reference I've seen
>on the web seems to imply that. But, as nearly as I can tell, it's not
>the same.
>
>The IEEE standard for 32-bit floats says the format should be
>
> sign -- 1 bit
> exponent -- 8 bits, power of 2, split on 127
With the proviso that the values of 0 and 255 for the exponent are
special cases reserved for 0, Inf, denormals, and NaN.
> mantissa -- 23 bits + phantom bit in bit 24.
>
>The Intel processor seems to use the following:
>
> sign -- 1 bit
> exponent -- _SEVEN_ bits, power of _FOUR_
> mantissa -- sometimes 23 bits, sometimes 24. Sometimes phantom bit,
>sometimes not.
> When it's there, it's in bit _TWENTY_THREE_ <!>
I don't think so. Are you mistaking the lsb of the exponent for the
"visible" phantom bit?
[...]
>
>You'll see that 1 --> 3f800000 (high bit is visible)
seee eeee emmm mmmm mmmm mmmm mmmm mmmm
0011 1111 1000 0000 0000 0000 0000 0000
s = 0, e = 127, m = 0
(-1)^s * 2^(e-127) * (1+m/(2^23)) = 1*1*1 = 1.0
>but 2 --> 40000000 (high bit is not)
seee eeee emmm mmmm mmmm mmmm mmmm mmmm
0100 0000 0000 0000 0000 0000 0000 0000
s = 0, e = 128, m = 0
(-1)^s * 2^(e-127) * (1+m/(2^23)) = 1*2*1 = 2.0
>
>Try a few others and see what you get. Some will surprise you.
I'm not finding any surprises.
1.5 -> 3fc00000
seee eeee emmm mmmm mmmm mmmm mmmm mmmm
0011 1111 1100 0000 0000 0000 0000 0000
s = 0, e = 127, m = 0x400000
(-1)^s * 2^(e-127) * (1+m/(2^23)) = 1*1*1.5 = 1.5
2.5 -> 40200000
seee eeee emmm mmmm mmmm mmmm mmmm mmmm
0100 0000 0020 0000 0000 0000 0000 0000
s = 0, e = 128, m = 0x400000
(-1)^s * 2^(e-127) * (1+m/(2^23)) = 1*2*1.25 = 2.5
Perhaps I'm misunderstanding your point?
Regards,
-=Dave
--
Change is inevitable, progress is not.
|