I l@ve RuBoard Previous Section Next Section

5.8 Types of Floats

The float type also comes in various flavors. float denotes normal precision (usually 4 bytes). double indicates double precision (usually 8 bytes), giving the programmer twice the range and precision of single-precision (float) variables.

The quantifier long double denotes extended precision. On some systems this is the same as double; on others, it offers additional precision. All types of floating-point numbers are always signed.

On most machines, single-precision floating-point instructions execute faster (but less accurately) than double precision. Double precision gains accuracy at the expense of time and storage. In most cases float is adequate; however, if accuracy is a problem, switch to double (see Chapter 19).

    I l@ve RuBoard Previous Section Next Section