< previous page page_529 next page >

Page 529
0529-01.gif
Figure 10-4
Coding of Some Floating Point Numbers
These two answers are the same in the thousands place, but different thereafter. The error behind this discrepancy is called representational error.
Because of representational errors, it is unwise to use a floating point number as a loop control variable. Because precision may be lost in calculations involving floating point numbers, it is difficult to predict when (or even if) a loop control variable of type float (or double or long double) will become equal to the termination value. A count-controlled loop with a floating point control variable may behave in an unpredictable fashion.

 
< previous page page_529 next page >