Graphics Reference
In-Depth Information
Table 11.1 The integer representation (in hex), sign, exponent, and mantissa (in binary) of
some IEEE-754 single-precision floating-point numbers.
Number
Bit Pattern
S
Exp
Mantissa (Binary)
0.0f
0x00000000
0
0
(0.)000 0000 0000 0000 0000 0000
0.1f
0x3dcccccd
0
123
(1.)100 1100 1100 1100 1100 1101
0.33333333f
0x3eaaaaab
0
125
(1.)010 1010 1010 1010 1010 1011
1.0f
0x3f800000
0
127
(1.)000 0000 0000 0000 0000 0000
2.0f
0x40000000
0
128
(1.)000 0000 0000 0000 0000 0000
100.0f
0x42c80000
0
133
(1.)100 1000 0000 0000 0000 0000
1000000.0f
0x49742400
0
146
(1.)111 0100 0010 0100 0000 0000
10.0f
0xc1200000
1
130
(1.)010 0000 0000 0000 0000 0000
machine epsilon (2 23 )
0x34000000
0
104
(1.)000 0000 0000 0000 0000 0000
smallest positive (2 126 )
0x00800000
0
1
(1.)000 0000 0000 0000 0000 0000
comparison would order the numbers as follows:
<
<
<
<
<
<
<
0.0
1.0
2.0
...
0.0
1.0
2.0
...
If desired, this problem can be overcome by inverting the integer range correspond-
ing to the negative floating-point numbers (by treating the float as an integer in some
machine-specific manner) before ordering the numbers and afterward restoring the
floating-point values through an inverse process.
Note that the number 0 cannot be directly represented by the expression V
=
2 E 127 . In fact, certain bit strings have been set aside in the representa-
tion to correspond to specific values, such as zero. These special values are indicated
by the exponent field being 0 or 255. The possible values are determined as described
in Table 11.2.
Using the normalized numbers alone, there is a small gap around zero when
looking at the possible representable numbers on the number line. To fill this gap,
the IEEE standard includes denormalized (or subnormal ) numbers, an extra range of
small numbers used to represent values smaller than the smallest possible normalized
number (Figure 11.4).
The IEEE standard also defines the special values plus infinity, minus infinity,
and not-a-number (
1) S
(
(1. F )
INF , and NaN , respectively). These values are further
discussed in Section 11.2.2. The signed zero (
+
INF ,
0) fills a special role to allow, for
+
example, the correct generation of
INF or
INF when dividing by zero. The signed
=+
zero compares equal to 0; that is
0
0 is true.
 
Search WWH ::




Custom Search