[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


fp_contract

Description:

Controls the use of special floating point instructions to improve performance.

Compatibility:

This pragma is compatible with the following platform targets:

68K

PowerPC

NEC V800
Intel x86
MIPS
Embedded 68K

Prototype:
  #pragma fp_contract on | off | reset Remarks:

This pragma applies to PowerPC programming only.

If this pragma is on, the compiler uses such PowerPC instructions as FMADD, FMSUB, and FNMAD to speed up floating-point computations. However, certain computations give unexpected results when this pragma is on. For example:


register double A, B, C, D, Y, Z;
register double T1, T2;

A = C = 2.0e23;
B = D = 3.0e23;

Y = (A * B) - (C * D);
printf("Y = %f\n", Y);
/* prints 2126770058756096187563369299968.000000 */

T1 = (A * B); T2 = (C * D); Z = T1 - T2; printf("Z = %f\n", Z); /* prints 0.000000 */

When this option is off, Y and Z have the same value.

This pragma corresponds to the Use FMADD & FMSUB option in the PowerPC Processor settings panel. To check whether this option is on, use __option (fp_contract), described in "Checking Options."


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000