[Cfp-interest 2315] Re: Flushed subnormals

Jim Thomas jaswthomas at sbcglobal.net
Thu Jan 13 10:31:31 PST 2022



> On Jan 12, 2022, at 12:54 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> More thoughts on:
> 
>>> Some opinions from stackoverflow.com say (since the C standard does not explicitly define the behaviour of flushed
>>> subnormals), it is undefined behaviour (UB). Other opinions say treat them as another form of zero.
> 
> One idea:
> The C standard does not define the behaviour of
>  integer arithmetic
>  non-decimal floating-point arithmetic
> Does that make it UB?
> Also, why are flushed subnormals special?
> 
> On the other hand, C does have in 5.2.4.2.2#8
> The accuracy of the floating-point operations (+ ,- , * , / ) and of the library functions in <math.h>
> and <complex.h> that return floating-point results is implementation-defined, as is the accuracy of
> the conversion between floating-point internal representations and string representations performed
> by the library functions in <stdio.h>, <stdlib.h>, and <wchar.h>. The implementation may state
> that the accuracy is unknown. Decimal floating-point operations have stricter requirements.
> 
> So, the accuracy of FP operations with subnormals is implementation defined.
> 
> Aside: I do not see where the C standard has stricter accuracy requirements for decimal FP.

6.10.8.3 has

__STDC_IEC_60559_DFP__ The integer constant yyyymmL, intended to indicate support of decimal floating types and conformance to Annex F for IEC 60559 decimal floating-point arithmetic.

That is, support for decimal floating types entails support for Annex F which includes the correct rounding requirements of IEC 60559 (except for transcendental functions).

Also, 6.9#5 says

Operators involving decimal floating types are evaluated according to the semantics of IEC 60559, including production of results with the preferred quantum exponent as specified in IEC 60559.

Semantic of IEC 60559 include correct rounding.

> 5.2.4.2.3#9 does have requirements on quantum exponents.
> 
> So, do we need the green part of http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2797.htm
> 

Yes. The green text gives guidance to non-IEC 60559 implementations regarding which values to classify as subnormal.

- Jim Thomas

> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com      Testing, numerics, programming
> +1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
> Sample C99+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
> 
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20220113/731c30e4/attachment.htm>


More information about the Cfp-interest mailing list