Do not set errno for overflowing NaN payload in strtod/nan (bug 32045)

Florian Weimer fweimer@redhat.com
Wed Aug 21 11:10:57 GMT 2024


* Joseph Myers:

> As reported in bug 32045, it's incorrect for strtod/nan functions to
> set errno based on overflowing payload (strtod should only set errno
> for overflow / underflow of its actual result, and potentially if
> nothing in the string can be parsed as a number at all; nan should be
> a pure function that never sets it).  Save and restore errno around
> the internal strtoull call and add associated test coverage.
>
> Tested for x86_64.
>
> ---
>
> This patch is relative to a tree with
> <https://sourceware.org/pipermail/libc-alpha/2024-August/159314.html>
> (pending review) applied.

Mechanics look okay to me.  I trust you to interpret the standard
correctly.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian



More information about the Libc-alpha mailing list