3 ms·
My copy of C11 says Annex F (normative) IEC 60559 floating-point arithmetic F.1 Introduction This annex specifies C language support for the I
by cperciva 6y ago
My copy of C11 says
Annex F
(normative)
IEC 60559 floating-point arithmetic
F.1 Introduction
This annex specifies C language support for the IEC
60559 floating-point standard [...] previously designated
ANSI/IEEE 754-1985.
- titzer 6y agoC "supports" whatever the hardware and compiler feel like supporting. It absolutely does not mandate anything. In particular, there are a number of particularly simple compiler optimizations that are not forbidden, though they are not technically correct according to IEEE 754, such as algebraic reassociation and simple commutativity. Moreover, C allows subexpressions to be computed in higher precision (e.g. 80 bit "long double"), which is observable. That last one is primarily due to the x87 FPU coprocessor design that has given us a good 35 years of headaches. Good riddance to that!
- shakna 6y ago> Support for Annex F (IEEE-754 / IEC 559) of C99/C11 > The Clang compiler does not support IEC 559 math functionality. Clang also does not control and honor the definition of __STDC_IEC_559__ macro. Under specific options such as -Ofast and -ffast-math, the compiler will enable a range of optimizations that provide faster mathematical operations that may not conform to the IEEE-754 specifications. The macro __STDC_IEC_559__ value may be defined but ignored when these faster optimizations are enabled. If you make use of Clang, you won't find support for Annex F, and in point of fact you can't even macro check to see if it even will support Annex F. The story with GCC is... More complicated. It guarantees it'll follow Annex F for only some operations [0]. So the upshot is... Most people can't tell when and how Annex F might be followed. [0] https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Floating-point-implementation.html https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gcc/Floating-point-...