Search code examples
cfloating-pointieee-754standards-compliance

If __STDC_IEC_559__ is not defined, then how to determine that FP (at least partially) conforms to IEEE 754?


If __STDC_IEC_559__ is not defined, then how to determine at compile time that FP implementation of a (unknown in advance) C compiler (at least partially) conforms to IEEE 754 and not to other FP standard / document?


Solution

  • There is no other relevant standard. Either the implementation mostly conforms/attempts to conform to Annex F (thus IEEE 754) or it's sufficiently broken that you can't use it for floating point. So for practical purposes, if you want to do floating point, you just document a dependence on having working floating point to the extent you need, and treat compilers that don't provide that as unsupported. There's no alternative you need to detect and also support.