This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] Fix overflow handling for expm1l on x86.
- From: Andreas Schwab <schwab at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 19 Oct 2009 16:38:45 +0200
- Subject: [PATCH] Fix overflow handling for expm1l on x86.
2009-10-19 Andreas Schwab <schwab@redhat.com>
* include/math.h: Add hidden proto for __expl.
* sysdeps/ieee754/ldbl-96/w_expl.c: Add hidden alias.
* sysdeps/i386/fpu/s_expm1l.S: Call __expl instead of
__ieee751_expl on overflow.
diff --git a/include/math.h b/include/math.h
index 1005804..eb4ef09 100644
--- a/include/math.h
+++ b/include/math.h
@@ -25,6 +25,7 @@ libm_hidden_proto (__fpclassifyf)
# ifndef __NO_LONG_DOUBLE_MATH
libm_hidden_proto (__fpclassifyl)
+libm_hidden_proto (__expl)
libm_hidden_proto (__expm1l)
# endif
diff --git a/sysdeps/i386/fpu/s_expm1l.S b/sysdeps/i386/fpu/s_expm1l.S
index b69b22b..60b5b82 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 <sysdep.h>
#include <machine/asm.h>
#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/ldbl-96/w_expl.c b/sysdeps/ieee754/ldbl-96/w_expl.c
index b8152ce..53bb143 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)
--
1.6.5.1
Andreas.
--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."