19.1 Floating-Point Format

I l @ ve RuBoard

Floating-point numbers consist of three parts : a sign, a fraction, and an exponent. Our fraction is expressed as a four-digit decimal. The exponent is a single-decimal digit. So our format is:

± f.fff x 10 ± e

where:

±

is the sign (plus or minus).

f.fff

is the four-digit fraction.

±e

is the single-digit exponent.

Zero is +0.000 x 10 +0 . We represent these numbers in "E" format: ± f.fff E ± e . This format is similar to the floating-point format used in many computers. The IEEE has defined a floating-point standard (#742), but not all machines use it.

Table 19-1 shows some typical floating-point numbers.

Table 19-1. Floating-point examples

Notation

Number

+1.000E+0

1.0

+3.300E+5

330000.0

-8.223E-3

-0.008223

+0.000E+0

0.0

The floating-point operations defined in this chapter follow a rigid set of rules. To minimize errors we make use of a guard digit . That is an extra digit added to the end of the fraction during computation. Many computers use a guard digit in their floating-point units.

I l @ ve RuBoard


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net