RISC System/6000 Floating Point Hardware

The RISC/6000 floating-point hardware performs all computations in IEEE double precision (eight
byte representation), equivalent to double in C and C++ programs. Single-precision  (four
byte representation) (float) values are automatically converted to double precision before they are used, and all results are calculated in double precision. Double precision provides greater range and precision than single precision does Double precision values have an approximate range of 10(-308) to 10(+308) and precision of about 16 decimal digits. Single precision values have an approximate range of 10(-38) to 10(+38), with about 7 decimal digits of precision.

When results must be converted to single precision, rounding operations are used. A rounding operation produces the correct single-precision value based on the IEEE rounding mode in effect. Because explicit rounding operations are required, single-precision computations are often slower than double precision computations. On many other machines the reverse is true: single-precision operations are faster than double-precision operations. Code ported from other systems can show different performance on a RISC System/6000 computer. See the -qfloat=rndsngl compiler
option for more information about single precision.

The RISC System/6000 hardware also provides a special set of double-precision operations that multiply two numbers and add a third number to the product. These combined multiply-add (maf) operations are performed in the same time as a multiply or an add operation alone. The maf functions provide an extension to the IEEE standard because they perform the multiply and add with one (rather than two) rounding errors. The maf functions are both faster and more accurate than the equivalent separate operations. Use the nomaf option to suppress the generation of these multiply-add instructions.

Note: The PowerPC and Power3 hardware platforms perform computations in either single or double precision. Considerations regarding single precision do not apply to these platforms.

Detecting Floating-Point Exceptions
A number of floating-point exceptions can be detected by the floating-point hardware: invalid operation, division by zero, overflow, underflow, and inexact. By default, all exceptions are ignored. However, if you use the flttrap option, any or all of these exceptions can be detected. (For an example of how this works, see Sample TRAP Signal Handler.) In addition, when you add suitable support code to your program, program execution can continue after an exception occurs, and you can then modify the results of operations causing exceptions.

Refer to "Floating-Point Processor Overview" and "Floating-Point Exceptions" in the AIX Version 4 Assembler Language Reference for more information about RISC System/6000 floating-point processing.



Compile-Time Floating Point Arithmetic
Floating-Point Compiler Options
Rounding Mode Restrictions


Sample TRAP Signal Handler


float Compiler Option
flttrap Compiler Option