diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-06-08 21:32:57 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-06-08 21:32:57 +0000 |
commit | 9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a (patch) | |
tree | b4d6e0cee63b44011a3cfbf6e4be60db0cd51de4 /math/s_ldexp.c | |
parent | 40720ec9f98d57214d73d6fa98019e684f2eb45a (diff) | |
download | glibc-9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a.tar.gz glibc-9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a.tar.xz glibc-9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a.zip |
Fix ldexp, scalbn, scalbln for sNaN input (bug 20225).
The wrapper implementations of ldexp / scalbn / scalbln (architecture-independent), and their float / long double variants, return sNaN for sNaN input. This patch fixes them to add relevant arguments to themselves so that qNaN is returned in this case. Tested for x86_64 and x86. [BZ #20225] * math/s_ldexp.c (__ldexp): Add non-finite or zero argument to itself. * math/s_ldexpf.c (__ldexpf): Likewise. * math/s_ldexpl.c (__ldexpl): Likewise. * math/w_scalbln.c (__w_scalbln): Likewise. * math/w_scalblnf.c (__w_scalblnf): Likewise. * math/w_scalblnl.c (__w_scalblnl): Likewise. * math/libm-test.inc (scalbn_test_data): Add sNaN tests. (scalbln_test_data): Likewise.
Diffstat (limited to 'math/s_ldexp.c')
-rw-r--r-- | math/s_ldexp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/math/s_ldexp.c b/math/s_ldexp.c index 0248ba2c44..ee53695d71 100644 --- a/math/s_ldexp.c +++ b/math/s_ldexp.c @@ -20,7 +20,7 @@ static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $"; double __ldexp(double value, int exp) { - if(!isfinite(value)||value==0.0) return value; + if(!isfinite(value)||value==0.0) return value + value; value = __scalbn(value,exp); if(!isfinite(value)||value==0.0) __set_errno (ERANGE); return value; |