Sun Studio 12: C++ User's Guide

A.2.25 –fprecision=p

x86: Sets the non-default floating-point precision mode.

The –fprecision option sets the rounding precision mode bits in the Floating Point Control Word. These bits control the precision to which the results of basic arithmetic operations (add, subtract, multiply, divide, and square root) are rounded.

A.2.25.1 Values

p must be one of the following values.

Table A–11 The -fprecision Values

Value 

Meaning  

single

Rounds to an IEEE single-precision value. 

double

Rounds to an IEEE double-precision value. 

extended

Rounds to the maximum precision available. 

If p is single or double, this option causes the rounding precision mode to be set to single or double precision, respectively, when a program begins execution. If p is extended or the –fprecision option is not used, the rounding precision mode remains at the extended precision.

The single precision rounding mode causes results to be rounded to 24 significant bits, and double precision rounding mode causes results to be rounded to 53 significant bits. In the default extended precision mode, results are rounded to 64 significant bits. This mode controls only the precision to which results in registers are rounded, and it does not affect the range. All results in register are rounded using the full range of the extended double format. Results that are stored in memory are rounded to both the range and precision of the destination format, however.

The nominal precision of the float type is single. The nominal precision of the long double type is extended.

Defaults

When the –fprecision option is not specified, the rounding precision mode defaults to extended.

Warnings

This option is effective only on x86 devices and only if used when compiling the main program. On SPARC devices, this option is ignored.