mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
* sysdeps/ieee754/dbl-64/s_expm1.c: Set errno for overflow.
* sysdeps/ieee754/flt-32/s_expm1f.c: Likewise. * sysdeps/x86_64/fpu/s_expm1l.S: Likewise.
This commit is contained in:
parent
49768bb93e
commit
f0e3c47fd6
@ -1,5 +1,9 @@
|
||||
2009-04-26 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* sysdeps/ieee754/dbl-64/s_expm1.c: Set errno for overflow.
|
||||
* sysdeps/ieee754/flt-32/s_expm1f.c: Likewise.
|
||||
* sysdeps/x86_64/fpu/s_expm1l.S: Likewise.
|
||||
|
||||
* sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errors in
|
||||
atanh should set ERANGE.
|
||||
|
||||
|
@ -112,6 +112,7 @@ static char rcsid[] = "$NetBSD: s_expm1.c,v 1.8 1995/05/10 20:47:09 jtc Exp $";
|
||||
* to produce the hexadecimal values shown.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
#define one Q[0]
|
||||
@ -159,7 +160,10 @@ Q[] = {1.0, -3.33333333333331316428e-02, /* BFA11111 111110F4 */
|
||||
return x+x; /* NaN */
|
||||
else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
|
||||
}
|
||||
if(x > o_threshold) return huge*huge; /* overflow */
|
||||
if(x > o_threshold) {
|
||||
__set_errno (ERANGE);
|
||||
return huge*huge; /* overflow */
|
||||
}
|
||||
}
|
||||
if(xsb!=0) { /* x < -56*ln2, return -1.0 with inexact */
|
||||
if(x+tiny<0.0) /* raise inexact */
|
||||
|
@ -17,6 +17,7 @@
|
||||
static char rcsid[] = "$NetBSD: s_expm1f.c,v 1.5 1995/05/10 20:47:11 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include "math.h"
|
||||
#include "math_private.h"
|
||||
|
||||
@ -63,7 +64,10 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
|
||||
return x+x; /* NaN */
|
||||
if(hx==0x7f800000)
|
||||
return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */
|
||||
if(x > o_threshold) return huge*huge; /* overflow */
|
||||
if(x > o_threshold) {
|
||||
__set_errno (ERANGE);
|
||||
return huge*huge; /* overflow */
|
||||
}
|
||||
}
|
||||
if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */
|
||||
if(x+tiny<(float)0.0) /* raise inexact */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ix87 specific implementation of exp(x)-1.
|
||||
Copyright (C) 1996, 1997, 2001, 2002, 2008 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996,1997,2001,2002,2008,2009 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
Based on code by John C. Bowman <bowman@ipp-garching.mpg.de>.
|
||||
@ -51,7 +51,7 @@ ENTRY(__expm1l)
|
||||
movzwl 8+8(%rsp), %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 __expl // (if num is denormal, it is at least >= 64.0)
|
||||
|
||||
fldt 8(%rsp) // x
|
||||
fxam // Is NaN or +-Inf?
|
||||
@ -76,7 +76,7 @@ ENTRY(__expm1l)
|
||||
fscale // 2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
||||
fsubrl MO(one) // 1-2^int(log2(e)*x) : int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
||||
fstp %st(1) // 1-2^int(log2(e)*x) : 2^(log2(e)*x)-2^int(log2(e)*x)
|
||||
fsubrp %st, %st(1) // 2^(log2(e)*x)
|
||||
fsubrp %st, %st(1) // 2^(log2(e)*x)-1
|
||||
ret
|
||||
|
||||
2: testl $0x200, %eax // Test sign.
|
||||
|
Loading…
Reference in New Issue
Block a user