[cfp-interest 3653] Re: C2Y's canonicalise() in AnnexF - F.10.9.7

Jim Thomas jaswthomas at sbcglobal.net
Mon Oct 13 17:01:02 PDT 2025



> On May 31, 2025, at 6:46 PM, Damian McGuckin <damianm at esi.com.au> wrote:
> 
> 
> Looking at the sentence-by-sentence text in F.10.9.7 which deals with
> special cases/issues of the canonicalize() floating point routine.
> 
> Consider:
> 
> 	The canonicalize functions produce 451) the canonical version of the
> 	representation in the object pointed to by the argument x.
> 
> This looks more like text which is better suited to Section 7? Hmmm????

Section 7 says the functions “attempt to produce a canonical version of the floating-point representation …”. The functions can fail (which is indicated by a nonzero return value). However, F.10.9.7 requires that the functions produce the canonical representation as defined by ISO/IEC 60559.

> 
> COnsider:
> 
> 	If the input *x is a signaling NaN, the "invalid" floating-point
> 	exception is raised and a (canonical) quiet NaN (which should be
> 	the canonical version of that signaling NaN made quiet) is produced.
> 
> Writing this in the form of the rest of Annex F, should this not say
> 
> 	canonicalize(cx, x) returns a canonical (quiet) NaN and raises the
> 	"invalid" floating-point exception when *x is a signaling NaN.
> 
> Is using 'when' instead of 'for' mathematically correct?  It reads better
> 
> The rest of the explanation should be inferred from Section 7 and if it is not clear enough there, then why not enhance the text in Section 7. 

C doesn’t generally specify special cases in Clause 7. NaNs, floating-point exceptions, and canonical encodings are extensions that are well defined in Annex F, but not in Clause 7.

> 
> 
> Consider:
> 
> 	For quiet NaN, infinity, and finite inputs, the functions raise no
> 	floating-point exceptions.
> 
> That is the default/normative for all but a quiet NaN. Note quite sure how to write this case to fit in with the style of Annex F. How about:
> 
> 	canonicalize(cx, x) returns a canonical (quiet) NaN when *x is a
> 	quiet NaN.
> 
> As a quiet NaN is normative, you do not need to say quiet but do we need to emphasise it? Section 7 already says the result is a canonalical quiet NaN the way I read it.

Unlike most math functions, canonicalize is a function at the bit-representation (bit-string) level. At this level, signaling NaNs exist (for Annex F implementations), whether or not the implementation supports them. I think the Annex F specification for canonicalize needs to be explicit about quiet and signaling NaNs.

- Jim Thomas

> 
> Comments - Damian
> _______________________________________________
> cfp-interest mailing list
> cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the cfp-interest mailing list