[PATCH] math: Fix errno setting for narrowing sqrt functions on underflow [BZ #33393]

Collin Funk collin.funk1@gmail.com
Sun Oct 19 19:16:51 GMT 2025


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:

>> The CHECK_NARROW_SQRT macro in math-narrow.h was not setting errno to
>> ERANGE when an underflow exception occurred during narrowing square root
>> operations. While the FE_UNDERFLOW exception flag was correctly set, errno
>> remained unchanged, violating IEEE 754 and POSIX requirements.
>
> I don't see an issue that needs to be fixed. errno as a concept is highly problematic
> to start with.

errno would be fine if every operating system/libc set it to the same
value in all cases. But that will never happen. :)

Collin


More information about the Libc-alpha mailing list