[cfp-interest 3477] Re: frexp() in Annex F

Vincent Lefevre vincent at vinc17.net
Wed May 28 01:10:05 PDT 2025


On 2025-05-28 11:16:41 +1000, Damian McGuckin wrote:
> 
> Vincent,
> 
> On Mon, 26 May 2025, Vincent Lefevre wrote:
> 
> > But I would avoid "stores" as this says what an implementation does
> > rather than a status or a property (but the implementation does not
> > have to store anything in the ?? case). For instance, I would say:
> > "the object pointed to by p contains an unspecified value".
> 
> How would you suggest rephrasing the line from F.10.4.7:
> 
> 	frexp (NaN, p) stores an unspecified value in the object pointed
> 	to by p (and returns a NaN)
> 
> The best I have is:
> 
> 	frexp (NaN, p) returns (a NaN ) with an unspecified value in the
> 	object pointed to by p
> 
> Thanks - Damian

I don't like the parentheses very much as I don't know how this could
be understood by the reader.

I think that both

  frexp (NaN, p) returns with an unspecified value in the object
  pointed to by p.

and

  frexp (NaN, p) returns a NaN with an unspecified value in the object
  pointed to by p.

would be OK, though the latter is redundant for the return value.
I don't have any better suggestion.

BTW, there are two other issues:

1. What is the point of F.10.4.7p2, which says "frexp raises no
floating-point exceptions if value is not a signaling NaN."?
There is nothing like that for the other functions.

2. F.10.1p14 "Functions with a NaN argument return a NaN result and
raise no floating-point exception, except where explicitly stated
otherwise." is misleading as the recommended practice F.2.2p6 is

  Any floating-point operator or <math.h> function or macro with
  a signaling NaN input, unless explicitly specified otherwise,
  raises an "invalid" floating-point exception.

and F.10.4.7p2 could be regarded as something being explicitly
specified otherwise (since it says "raise no floating-point
exception").

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)


More information about the cfp-interest mailing list