5.2.4.2.2 Characteristics of floating types <float.h>
The values of operations with floating operands, and the values that are subject to both the usual arithmetic conversions and to floating constants are evaluated to a format whose range and precision may be greater than required by the type. The use of evaluation formats is characterized by the implementation-defined value of FLT_EVAL_METHOD:
Table D–1 The FLT_EVAL_METHOD Values
Value |
Meaning |
---|---|
-1 |
Indeterminable. |
0 |
The compiler evaluates all operations and constants just to the range and precision of the type. |
1 |
The compiler evaluates operations and constants of type float and double to the range and precision of a double. Evaluate long double operations and constants to the range and precision of a long double. |
2 |
The compiler evaluates all operations and constants to the range and precision of a long double. |
When you include float.h on SPARC architectures, FLT_EVAL_METHOD expands to 0 by default and all floating point expressions are evaluated according to their type.
When you include float.h on x86 architectures, FLT_EVAL_METHOD expands to -1 by default (except when -xarch=sse2 or -xarch=amd64), and all floating point constant expressions are evaluated according to their type and all other floating point expressions are evaluated as long double.
When you specify -flteval=2 and include float.h, FLT_EVAL_METHOD expands to 2 and all floating expressions are evaluated as long double. See B.2.20 -flteval[={any|2}] for more information.
When you specify -xarch=sse2 or -xarch=amd64 on x86, and include float.h, FLT_EVAL_METHOD expands to 0 and all floating point expressions are evaluated according to their type.
The -Xt option does not affect the expansion of FLT_EVAL_METHOD, even though float expressions are evaluated as double. See B.2.63 -X[c|a|t|s] for more information.
The -fsingle option causes float expressions to be evaluated with single precision. See B.2.27 -fsingle for more information.
When you specify -fprecision on x86 architectures with -xarch=sse2 or -xarch=amd64 and include float.h, FLT_EVAL_METHOD expands to -1.