[Cfp-interest] change for canonicalize
Jim Thomas
jaswthomas at sbcglobal.net
Thu Feb 9 18:24:15 PST 2012
Here's a change I came up based on our teleconference discussion today. Please review ASAP.
-Jim
14.9 The canonicalize functions
IEC 60559 requires an arithmetic convertFormat operation from each format to itself. This operation produces a canonical encoding and, for a signaling NaN input, raises the “invalid” floating-point and delivers a quiet NaN. C assignment (and conversion as if by assignment) to the same format may be implemented as a convertFormat operation or as a copy operation. The suggested change to C11 below provides the IEC 60559 convertFormat operation.
Suggested change to C11:
As the last subclause of 7.12.11, add:
7.12.11.n The canonicalize functions
Synopsis
#include <math.h>
int canonicalize(double * cx, const double * x);
int canonicalizef(float * cx, const float * x);
int canonicalizel(long double * cx, const long double * x);
Description
The canonicalize functions attempt to produce a canonical version of the floating-point representation in the object pointed to by the argument x and store the canonical result in the object pointed to by the argument cx. If the input *x is a signalling NaN, the canonicalize functions are intended to store a canonical quiet NaN. If a canonical result is not produced the object pointed to by cx in unchanged.
Returns
The functions return zero if a canonical result is stored in the object pointed to by cx. Otherwise they return a nonzero value.
After new F.10.8.4, add:
F.10.8.5 The canonicalize functions
The canonicalize functions produce[1] the canonical version of the representation in the object pointed to by the argument x. If the imput *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. For quiet NaN, infinity, and finite inputs, the functions raise no floating-point exceptions.
[1] As if x*1e0 were computed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120209/02a59534/attachment-0001.html
More information about the Cfp-interest
mailing list