4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 19:40:33 +08:00

Fix truncf for sNaN input

Make line 47 in sf_trunc.c reachable. While converting the double
precision function trunc to the single precision version truncf an error
was introduced into the special case. This special case is meant to
catch both NaNs and infinities, however qNaNs and infinities work just
fine with the simple return of x (line 51). The only error occurs for
sNaNs where the same sNaN is returned and no invalid exception is
raised.
This commit is contained in:
Fabian Schriever 2020-03-11 10:58:05 +01:00 committed by Ken Brown
parent 3af9fe92bb
commit 83aabb816f

View File

@ -42,7 +42,7 @@
}
else
{
if (exponent_less_127 == 255)
if (exponent_less_127 == 128)
/* x is NaN or infinite. */
return x + x;