diff options
author | Joseph Myers <joseph@codesourcery.com> | 2016-06-08 21:55:06 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2016-06-08 21:55:06 +0000 |
commit | 9bd3ef8e19b19fb3cfcf99a33a1493035891b990 (patch) | |
tree | ca830d25692074e5b5800ee2f530a2d314fa2a0b /sysdeps/i386 | |
parent | 9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a (diff) | |
download | glibc-9bd3ef8e19b19fb3cfcf99a33a1493035891b990.tar.gz |
Fix i386/x86_64 expl, exp10l, expm1l for sNaN input (bug 20226).
The i386 and x86_64 implementations of expl, exp10l and expm1l (code
shared between the functions) return sNaN for sNaN input. This patch
fixes them to add NaN inputs to themselves so that qNaN is returned in
this case.
Tested for x86_64 and x86.
[BZ #20226]
* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Add NaN argument to
itself.
* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL): Likewise.
* math/libm-test.inc (exp_test_data): Add sNaN tests.
(exp10_test_data): Likewise.
(expm1_test_data): Likewise.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r-- | sysdeps/i386/fpu/e_expl.S | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S index 64e0d96839..7d75fe22a1 100644 --- a/sysdeps/i386/fpu/e_expl.S +++ b/sysdeps/i386/fpu/e_expl.S @@ -102,7 +102,7 @@ ENTRY(IEEE754_EXPL) /* Below -64.0 (may be -NaN or -Inf). */ andb %ah, %dh cmpb $0x01, %dh - je 2f /* Is +-NaN, jump. */ + je 6f /* Is +-NaN, jump. */ jmp 1f /* -large, possibly -Inf. */ 4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */ @@ -144,7 +144,7 @@ ENTRY(IEEE754_EXPL) cmpb $0x05, %dh je 1f /* Is +-Inf, jump. */ cmpb $0x01, %dh - je 2f /* Is +-NaN, jump. */ + je 6f /* Is +-NaN, jump. */ /* Overflow or underflow; saturate. */ fstp %st fldt MO(csat) @@ -214,6 +214,9 @@ ENTRY(IEEE754_EXPL) fldz /* Set result to 0. */ #endif 2: ret +6: /* NaN argument. */ + fadd %st + ret END(IEEE754_EXPL) #ifdef USE_AS_EXPM1L libm_hidden_def (__expm1l) |