Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
No computer number system can represent all real numbers. Various systems can be used for a subset of real numbers. Number System Fixed-point Rational Floating-point Format i.f p/q mbe Characteristics Low-precision Difficult to work with Most common way to handle reals
We dont store the radix point so just make sure the radix point is always in the same position.
Floating-Point Numbers
If X is a real number, then its normal form representation is:
Figure 1: Parts of a floating-point number: Normalization Every binary number, except for the representation for the number zero, can be normalized so that the radix point falls to the right of the leftmost 1 bit. 37.2510 = 100101.012 = 1.0010101 x 25 7.62510 = 111.1012 = 1.11101 x 22 0.312510 = 0.01012 = 1.01 x 2-2 The radix point floats the correct position, thats why its called the floating point number. Because the leftmost digit is always 1, we dont need to store this bit.
The sign field The value is 0 for positive numbers (-1)0 = +1, and 1 for negative numbers (-1)1 = -1. The exponent field An unsigned 8-bit number, relative to a bias of 127. Example: exponent 5 is stored as (127+5=132) or 10000100 Example: exponent -4 is stored as (127+(-4)=123) or 01111011
The mantissa field A set of 0s and 1s to the right of the normalized binary number. Example: for the binary number 1.00101 23, the mantissa is 00101 The mantissa is stored in a 23 bit field, so we pad zeros to the right: o 00101000000000000000000
Other IEEE 754 Examples 0 1000 0011 0000 0000 0000 0000 0000 000 = 1 24 = 16 0 0011 0001 0000 0000 0000 0000 0000 000 = 1 2-78 = 3.3087e-24 0 1000 0001 0100 0000 0000 0000 0000 000 = 1.25 22 = 5