[Cfp-interest 2070] Re: Subnormals

Jim Thomas jaswthomas at sbcglobal.net
Wed Jul 21 06:45:28 PDT 2021


Here’s a rewording of Fred’s draft replacement for 5.2.4.2.2 #14:

Support for subnormal numbers is characterized by the implementation-defined values of FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, and LDBL_HAS_SUBNORM:

0  The type does not have subnormal numbers, or the type has subnormal numbers but arithmetic operations in the default rounding mode typically treat subnormal operands as zeros and replace subnormal results with zeros.

1  The type has subnormal numbers which operations consistently treat as nonzero. Appropriate for types with IEC 60559-style gradual underflow.

2  The type has subnormal numbers. Arithmetic operations in the default rounding mode typically replace subnormal results with zeros, but treat subnormal operands as nonzero.

4  The type has subnormal numbers. Arithmetic operations in the default rounding mode typically treat subnormal operands as zeros, but do not replace subnormal results with zeros.

-1 The type has subnormal numbers but their support is not consistent in any of the above ways.

Could 4 be merged with 0 (i.e. is 4 close enough to 0 for user purposes):

0'  The type does not have subnormal numbers, or the type has subnormal numbers but arithmetic operations in the default rounding mode typically treat subnormal operands as zeros.


I think any specification would have to receive a YES answer to all of the following questions:

Does it cover existing/expected implementations? 

Is it clear? Would implementers be able to determine how to define the macros? Would users be able to understand the meaning?

Would it be helpful to users?

Otherwise, I think we should propose that the type_HAS_SUBNORMS macros be removed from the C23 draft. This would clear the way for a fresh start, when more time and appropriate expertise are available.

- Jim Thomas


> On Jun 24, 2021, at 6:11 AM, Fred J. Tydeman <tydeman at tybor.com <mailto:tydeman at tybor.com>> wrote:
> 
> Attached is a zip file of my proposal on subnormals.
> Comments welcome.
> 
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com <mailto: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 <http://www.tybor.com/>
> Savers sleep well, investors eat well, spenders work forever.
> 
> <SUBNORM.ZIP>_______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net <mailto: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/20210721/dbf921a3/attachment.htm>


More information about the Cfp-interest mailing list