4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-08 10:09:32 +08:00

Cygwin: fix return value of sqrtl on negative infinity

The return value is now -NaN.

This fixes a bug in the mingw-w64 code that was imported into Cygwin.
The fix is consistent with Posix and Linux.  It is also consistent
with the current mingw-w64 code, with one exception: The mingw-w64
code sets errno to EDOM if the input is -NaN, but this appears to
differ from Posix and Linux.

Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html
This commit is contained in:
Ken Brown 2020-10-27 09:52:48 -04:00
parent c5bf5617c0
commit 784b811131
2 changed files with 8 additions and 2 deletions

View File

@ -73,8 +73,11 @@ __FLT_ABI (sqrt) (__FLT_TYPE x)
if (x_class == FP_ZERO)
return __FLT_CST (-0.0);
if (x_class == FP_NAN)
return x;
errno = EDOM;
return x;
return -__FLT_NAN;
}
else if (x_class == FP_ZERO)
return __FLT_CST (0.0);

View File

@ -37,5 +37,8 @@ Bug Fixes
- Fix assertion failure on an invalid path under /proc/<pid>/fd/.
Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246160.html
- Fix crash on stat(2)'ing /dev/ptmx on 32 bit
- Fix crash on stat(2)'ing /dev/ptmx on 32 bit.
Addresses: https://cygwin.com/pipermail/cygwin/2020-September/246218.html
- Fix return value of sqrtl on negative infinity.
Addresses: https://cygwin.com/pipermail/cygwin/2020-October/246606.html