[PATCH] math: Order signed zeros in fmin and fmax.
Vincent Lefevre
vincent@vinc17.net
Sun Dec 21 11:03:30 GMT 2025
On 2025-12-19 11:45:54 -0500, James Y Knight wrote:
> The C standard (at least from C99 till C23) does _not_ require
> fmin/fmax to order zeros by their sign, so glibc's previous behavior
> was entirely standards-conforming.
The glibc manual specifies more for its implementation:
The ‘fmin’ function returns the lesser of the two values X and Y.
It is similar to the expression
((x) < (y) ? (x) : (y))
except that X and Y are only evaluated once.
So, if x and y and both zeros, (x) < (y) is false, and y is returned.
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
More information about the Libc-alpha
mailing list