cfloating-pointc11standards-compliancec17

Are HAS_SUBNORM and __STDC_IEC_559__ dependent?


Are HAS_SUBNORM and __STDC_IEC_559__ dependent? For example:


Solution

  • Are HAS_SUBNORM and __STDC_IEC_559__ dependent?

    I'd suggest no.
    __STDC_IEC_559__ == 1 and xxx_HAS_SUBNORM != 1 possible.

    C17 Appendix F specifies what is needed to conform to __STDC_IEC_559__: "An implementation that defines __STDC_IEC_559__ shall conform to the specifications in this annex."

    Appendix F does not specify support of subnormal's and even has in 2 places describing functions:

    ... When subnormal results are supported, the returned value is exact and is independent of the current rounding direction mode. C17dr § F.10.7.2&3 2.

    This at least implies subnormal support is not required for those functions. Also see @Ian Abbott


    Nit:

    "__STDC_IEC_559__ is not 1." is more like "__STDC_IEC_559__ not defined", not "if defined and not 1".