Re: floating point representation
- From: "Nicolo Parenti" <spamtrap@xxxxxxxxxx>
- Date: Fri, 15 Sep 2006 15:21:42 -0400
waltbrad wrote:
I'm posting here again seeking help on understanding floating point
numbers. I'm an absolute novice, struggling with ASM concepts, but I
am able to write the basic programs offered in AOA.
Now, with floating point I do understand how they are stored. For
instance the single precision has the low order 23 bits as a mantissa,
the next 8 bits up are the exponent, and the H.O. bit is the sign bit.
Not quite. There are 24 bits of mantissa in a normalized value, but only 23 are stored. Since the highest bit is always 1, it can be implied.
I understand the excess-bias and understand the exponent is a power of
2.
But for the life of me I cannot construct a number manually from it's
stored representation.
For instance: the number '7', has the hex representation of
40E0_0000
which translates to:
0100 0000 1110 0000 0000 0000 0000 0000
So first I take the exponent 10000001 that is 129-127=2 and 2
squared is 4.
The Mantissa? Well I guess it's (2**22)+(2**21) = 6291456. So now I
have:
1.6291456 * 4 = 6.5165824
But this number itself is stored as 40D0_87D8
Which works out to be 6.1110624
You can break down the mantissa like this:
1 (implied) + 0.5 + 0.25 = 1.75
1.75 x 4 = 7.00
.
- References:
- floating point representation
- From: waltbrad
- floating point representation
- Prev by Date: floating point representation
- Next by Date: Re: floating point representation
- Previous by thread: floating point representation
- Next by thread: Re: floating point representation
- Index(es):
Relevant Pages
|
|