Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Schriever <fabian.schriever@gtd-gmbh.de>2020-03-11 12:58:05 +0300
committerCorinna Vinschen <corinna@vinschen.de>2020-03-11 14:10:58 +0300
commitc56f53a2a04577f6e84ac96477fc8dc804d544ef (patch)
tree89ee5e90daaf3fbcfcac8bdc3bf7240fc6013add /newlib/libm/common
parent91a8d0c90767f82202e08ba7e3fd6b4e1419ec00 (diff)
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.
Diffstat (limited to 'newlib/libm/common')
-rw-r--r--newlib/libm/common/sf_trunc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/newlib/libm/common/sf_trunc.c b/newlib/libm/common/sf_trunc.c
index 74ea933ce..8eb0554d8 100644
--- a/newlib/libm/common/sf_trunc.c
+++ b/newlib/libm/common/sf_trunc.c
@@ -42,7 +42,7 @@
}
else
{
- if (exponent_less_127 == 255)
+ if (exponent_less_127 == 128)
/* x is NaN or infinite. */
return x + x;