[Cfp-interest] printf, NaN, infinity

Jim Thomas jaswthomas at sbcglobal.net
Mon Nov 26 08:27:15 PST 2018


Is this proposal at the request of WG14? If so, what exactly was requested?

- Jim Thomas

> On Oct 24, 2018, at 8:39 AM, Fred J. Tydeman <tydeman at tybor.com> wrote:
> 
> printf NaN and infinity
> 
> ---
> Fred J. Tydeman        Tydeman Consulting
> tydeman at tybor.com <mailto:tydeman at tybor.com>      Testing, numerics, programming
> +1 (702) 608-6093 <tel:+1%20(702)%20608-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.
> 
> 
> Submitter:Fred Tydeman
> Submission Date: 2018-10-??
> Document: WG14 Ntttt
> Reference Documents: N2301 <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2301.htm>
> Summary
> 
> There is no way for a user's application to control what is output for a NaN or an infinity (the standard allows two forms for each).
> 
> Technical Corrigendum:
> 
> Change §7.21.6.1#4, precision bullet from:
> 
> An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point character for a, A, e, E, f, and F conversions, the maximum number of significant digits for the g and G conversions, or the maximum number of bytes to be written for s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional nonnegative decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
> to:
> 
> An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits (for finite values) to appear after the decimal-point character for a, A, e, E, f, and F conversions, the maximum number of significant digits (for finite values)for the g and G conversions, the number of characters for NaN or infinity values for a, A, e, E, f, F, g, and G conversions, or the maximum number of bytes to be written for s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional nonnegative decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
> Change in §7.21.6.1#8, f,F bullet from:
> 
> A double argument representing an infinity is converted in one of the styles [-]inf or [-]infinity - which style is implementation-defined. A double argument representing a NaN is converted in one of the styles [-]nan or [-]nan(n-char-sequence) - which style, and the meaning of any n-char-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.283)
> to:
> 
> A double argument representing an infinity is converted in one of the styles to [-]inf if the precision is missing or less than four, otherwise to or[-]infinity - which style is implementation-defined. A double argument representing a NaN is converted in one of the styles to [-]nan if the precision is missing or less than four, otherwise to or[-]nan(n-char-sequence) - which style, and the meaning of any n-char-sequence is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.283)
> Change §7.29.2.1#4, precision bullet from:
> 
> An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point wide character for a, A, e, E, f, and F conversions, the maximum number of significant digits for the g and G conversions, or the maximum number of wide characters to be written for s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional nonnegative decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
> to:
> 
> An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits (for finite values) to appear after the decimal-point wide character for a, A, e, E, f, and F conversions, the maximum number of significant digits (for finite values) for the g and G conversions, the number of wide characters for NaN or infinity values for a, A, e, E, f, F, g, and G conversions, or the maximum number of wide characters to be written for s conversions. The precision takes the form of a period (.) followed either by an asterisk * (described later) or by an optional nonnegative decimal integer; if only the period is specified, the precision is taken as zero. If a precision appears with any other conversion specifier, the behavior is undefined.
> Change in §7.29.2.1#8, f,F bullet from:
> 
> A double argument representing an infinity is converted in one of the styles [-]inf or [-]infinity - which style is implementation-defined. A double argument representing a NaN is converted in one of the styles [-]nan or [-]nan(n-wchar-sequence) - which style, and the meaning of any n-wchar-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.338)
> to:
> 
> A double argument representing an infinity is converted in one of the styles to [-]inf if the precision is missing or less than four, otherwise to or [-]infinity - which style is implementation-defined. A double argument representing a NaN is converted in one of the styles to [-]nan if the precision is missing or less than four, otherwise to or [-]nan(n-wchar-sequence) - which style, and the meaning of any n-wchar-sequence is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, respectively.338)
> Change §J.3.12
> 
> - The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar sequence printed for a NaN (7.21.6.1, 7.29.2.1).
> to:
> 
> - The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar sequence printed for a NaN (7.21.6.1, 7.29.2.1).
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net <mailto:Cfp-interest at oakapple.net>
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest <http://mailman.oakapple.net/mailman/listinfo/cfp-interest>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20181126/e6cf49b0/attachment-0001.html 


More information about the Cfp-interest mailing list