[Cfp-interest 3210] Re: Can nan() set errno?
Jim Thomas
jaswthomas at sbcglobal.net
Thu Aug 15 18:21:37 PDT 2024
> On Aug 14, 2024, at 3:28 PM, Fred J. Tydeman <tydeman at tybor.com> wrote:
>
> On Wed, 14 Aug 2024 10:11:55 -0500 (COT) Fred J. Tydeman wrote:
>>
>> Subject: [SC22WG14.26260] Can nan set errno?
>
> 7.5 Errors <errno.h> has the general statement:
>
> The value of errno may be set to nonzero by a library function call
> whether or not there is an error, provided the use of errno is not
> documented in the description of the function in this document.
>
> 7.12.2 Treatment of error conditions has several specific statements
> that apply to all <math.h> functions. So, overrides the 7.5 general
> statement.
>
> nan() is a <math.h> function, but is not a mathematical function.
> strtod() is not a <math.h> function; but it has words about
> overflow and underflow in the Returns section (that mirror 7.12.2).
>
> So, what should happen for
> nan("a_very_long_string_________");
> strtod("NAN(a_very_long_string_________)", nullptr);
> when the n-char-sequence is longer than what the nan returned can hold?
As stated in the strtod Description (7.24.2.6 #5), "the meaning of the n-char sequence is implementation-defined.” In particular, it does not need to be represented in the return NaN. An implementation is free to return the same NaN for all n-char sequences.
- Jim Thomas
>
>
> ---
> Fred J. Tydeman Tydeman Consulting
> tydeman at tybor.com Testing, numerics, programming
> +1 (702) 608-6093 Vice-chair of INCITS/C (ANSI "C")
> Sample C17+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.
>
> _______________________________________________
> Cfp-interest mailing list
> 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/20240815/c37d9f7c/attachment.htm>
More information about the Cfp-interest
mailing list