From b7805d0ba8948fcf5e406bf52530d9aba99f5954 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 19 Oct 2009 21:23:15 -0700 Subject: Correct errno handling in expm1. --- sysdeps/i386/fpu/s_expm1.S | 6 ++++++ sysdeps/i386/fpu/s_expm1f.S | 6 ++++++ sysdeps/i386/fpu/s_expm1l.S | 3 ++- sysdeps/ieee754/dbl-64/w_exp.c | 1 + sysdeps/ieee754/flt-32/w_expf.c | 1 + sysdeps/ieee754/ldbl-96/w_expl.c | 1 + 6 files changed, 17 insertions(+), 1 deletion(-) (limited to 'sysdeps') diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S index e761183639..c690a458f8 100644 --- a/sysdeps/i386/fpu/s_expm1.S +++ b/sysdeps/i386/fpu/s_expm1.S @@ -22,6 +22,7 @@ /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ +#include #include #ifdef __ELF__ @@ -48,6 +49,11 @@ l2e: .tfloat 1.442695040888963407359924681002 .text ENTRY(__expm1) + movzwl 4+6(%esp), %eax + xorb $0x80, %ah // invert sign bit (now 1 is "positive") + cmpl $0xc086, %eax // is num >= 704? + jae HIDDEN_JUMPTARGET (__exp) + fldl 4(%esp) // x fxam // Is NaN or +-Inf? fstsw %ax diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S index 88adb75b86..8645107274 100644 --- a/sysdeps/i386/fpu/s_expm1f.S +++ b/sysdeps/i386/fpu/s_expm1f.S @@ -22,6 +22,7 @@ /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ +#include #include #ifdef __ELF__ @@ -48,6 +49,11 @@ l2e: .tfloat 1.442695040888963407359924681002 .text ENTRY(__expm1f) + movzwl 4+2(%esp), %eax + xorb $0x80, %ah // invert sign bit (now 1 is "positive") + cmpl $0xc2b1, %eax // is num >= 88.5? + jae HIDDEN_JUMPTARGET (__expf) + flds 4(%esp) // x fxam // Is NaN or +-Inf? fstsw %ax diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S index b69b22bc62..60b5b82e20 100644 --- a/sysdeps/i386/fpu/s_expm1l.S +++ b/sysdeps/i386/fpu/s_expm1l.S @@ -22,6 +22,7 @@ /* Using: e^x - 1 = 2^(x * log2(e)) - 1 */ +#include #include #ifdef __ELF__ @@ -51,7 +52,7 @@ ENTRY(__expm1l) movzwl 4+8(%esp), %eax // load sign bit and 15-bit exponent xorb $0x80, %ah // invert sign bit (now 1 is "positive") cmpl $0xc006, %eax // is num positive and exp >= 6 (number is >= 128.0)? - jae __ieee754_expl // (if num is denormal, it is at least >= 64.0) + jae HIDDEN_JUMPTARGET (__expl) // (if num is denormal, it is at least >= 64.0) fldt 4(%esp) // x fxam // Is NaN or +-Inf? diff --git a/sysdeps/ieee754/dbl-64/w_exp.c b/sysdeps/ieee754/dbl-64/w_exp.c index 445c5788d2..1216492090 100644 --- a/sysdeps/ieee754/dbl-64/w_exp.c +++ b/sysdeps/ieee754/dbl-64/w_exp.c @@ -51,6 +51,7 @@ u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */ return z; #endif } +hidden_def (__exp) weak_alias (__exp, exp) #ifdef NO_LONG_DOUBLE strong_alias (__exp, __expl) diff --git a/sysdeps/ieee754/flt-32/w_expf.c b/sysdeps/ieee754/flt-32/w_expf.c index 4ba21c7c42..83b268f570 100644 --- a/sysdeps/ieee754/flt-32/w_expf.c +++ b/sysdeps/ieee754/flt-32/w_expf.c @@ -56,4 +56,5 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ return z; #endif } +hidden_def (__expf) weak_alias (__expf, expf) diff --git a/sysdeps/ieee754/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c index b8152cea65..53bb143734 100644 --- a/sysdeps/ieee754/ldbl-96/w_expl.c +++ b/sysdeps/ieee754/ldbl-96/w_expl.c @@ -57,4 +57,5 @@ u_threshold= -1.140019167866942050398521670162263001513e4; return z; #endif } +hidden_def (__expl) weak_alias (__expl, expl) -- cgit 1.4.1