|  3DSoftware.com > Programming > Floating Point > Page 2 |
|
Floating Point Numbers
Page 2
Historic Format (ANSI/IEEE) During the 1980s, the Institute of Electrical and Electronics Engineers (IEEE) devloped a binary format for floating point numbers in Basic coverage of the ANSI/IEEE format is provided in many books including: Antia, Numerical Methods for Scientists & Engineers 2/e, The ANSI/IEEE format consists of bits packed into a packet of adjacent bytes. The high order bit of the overall packet is a sign bit, the next bits are a biased exponent, and the remaining bits are the significand. That ordering of bits allows for easy machine sorting of numbers. There are two variants of the ANSI/IEEE format. The first variant is that format's single length overall packet, which is |
|
Integer Bit
A floating point number is unique only if it is normalized. Valid normalized numbers other than zero always have a non-zero digit as the leading digit of the significand. That will be the only digit to the left (on the whole number side) of the radix point. Note: In decimal IEEE numbers have binary digits the only possible non-zero digit is 1 so the leading digit of the significand is 1 if the number is a valid non-zero number. That leading bit is called the integer bit because it is the only digit to the left of the radix point in a normalized number. All the other bits represent the fraction of the normalized number. The IEEE format keeps track of when a number is zero or invalid, which is when the integer bit When the integer bit is not stored, it is a hidden bit. The two external ANSI/IEEE format variants do not store the integer bit (it is a hidden bit in those numbers). The internal IEEE format does store the integer bit, so that arithmetic operations can be performed on the number. |
|
Exponent
The exponent of an IEEE number is biased, which means it is stored as a positive number and must have a bias subtracted from it to retrieve the actual exponent. For a listing of the bias values, see the AMD manual referenced above. |
|
Denormal
IEEE numbers are low precision. Only a few bits of storage are used to store an IEEE exponent. Since such few bits are available to represent an exponent, not many exponents can be represented. You will often have non-zero numbers that are too small to be represented in IEEE format, because the unbiased IEEE exponent cannot be small enough. If a number is much smaller than a normal exponent would allow, that number can be converted to zero. If the number is only slightly smaller than IEEE can represent, it can be represented as a denormalized number with degraded precision but still non-zero. When you implement your own floating point numbers, you do not need to support denormalized numbers internally because you can specify a larger range of exponents than IEEE supports. Extremely small values are often only used in intermediate calculations. If you avoid using IEEE numbers for intermediate calculations, you can avoid working with denormals. |
| Page 2 | ||||||
|
|
Copyright © 2008 by 3D Software. All rights reserved. 3D Software, P.O. Box 221190, Sacramento CA 95822 USA www.3DSoftware.com Contact us |
| Thursday, 20-Nov-2008 11:57:26 GMT |