From: Ulrich Drepper Date: Fri, 29 May 2009 19:00:22 +0000 (-0700) Subject: Fix errno for boundary conditions in 128-bit long double. X-Git-Tag: fedora/glibc-2.10.90-1~8^2~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f3394bdf34e28b374e5569a7a74ddac734fb172;p=thirdparty%2Fglibc.git Fix errno for boundary conditions in 128-bit long double. Similar to the changes which went already in for the other formats, follow POSIX rules for errno. --- diff --git a/ChangeLog b/ChangeLog index 99ff1e390b5..b1fec55266f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-05-29 Jakub Jelinek + + * sysdeps/ieee754/ldbl-128/s_expm1l.c: Include . + (__expm1l): Set errno to ERANGE on overflow. + * sysdeps/ieee754/ldbl-128/s_tanl.c: Include . + (__tanl): Set errno to EDOM for ±Inf. + * sysdeps/ieee754/ldbl-128/s_cosl.c: Include . + (__cosl): Set errno to EDOM for ±Inf. + * sysdeps/ieee754/ldbl-128/s_sinl.c: Include . + (__sinl): Set errno to EDOM for ±Inf. + 2009-05-29 Jakub Jelinek * sysdeps/s390/s390-32/__longjmp.c (__longjmp): If CHECK_SP is diff --git a/sysdeps/ieee754/ldbl-128/s_cosl.c b/sysdeps/ieee754/ldbl-128/s_cosl.c index d1258b2cf15..ef61c3afdb7 100644 --- a/sysdeps/ieee754/ldbl-128/s_cosl.c +++ b/sysdeps/ieee754/ldbl-128/s_cosl.c @@ -44,6 +44,7 @@ * TRIG(x) returns trig(x) nearly rounded */ +#include #include "math.h" #include "math_private.h" @@ -66,7 +67,14 @@ return __kernel_cosl(x,z); /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7fff000000000000LL) return x-x; + else if (ix>=0x7fff000000000000LL) { + if (ix == 0x7fff000000000000LL) { + GET_LDOUBLE_LSW64(n,x); + if (n == 0) + __set_errno (EDOM); + } + return x-x; + } /* argument reduction needed */ else { diff --git a/sysdeps/ieee754/ldbl-128/s_expm1l.c b/sysdeps/ieee754/ldbl-128/s_expm1l.c index 78bbe65b537..a82489bb248 100644 --- a/sysdeps/ieee754/ldbl-128/s_expm1l.c +++ b/sysdeps/ieee754/ldbl-128/s_expm1l.c @@ -53,6 +53,7 @@ +#include #include "math.h" #include "math_private.h" @@ -121,7 +122,10 @@ __expm1l (long double x) /* Overflow. */ if (x > maxlog) - return (big * big); + { + __set_errno (ERANGE); + return (big * big); + } /* Minimum value. */ if (x < minarg) diff --git a/sysdeps/ieee754/ldbl-128/s_sinl.c b/sysdeps/ieee754/ldbl-128/s_sinl.c index 446a75f126c..dc509e72e52 100644 --- a/sysdeps/ieee754/ldbl-128/s_sinl.c +++ b/sysdeps/ieee754/ldbl-128/s_sinl.c @@ -44,6 +44,7 @@ * TRIG(x) returns trig(x) nearly rounded */ +#include #include "math.h" #include "math_private.h" @@ -66,7 +67,14 @@ return __kernel_sinl(x,z,0); /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7fff000000000000LL) return x-x; + else if (ix>=0x7fff000000000000LL) { + if (ix == 0x7fff000000000000LL) { + GET_LDOUBLE_LSW64(n,x); + if (n == 0) + __set_errno (EDOM); + } + return x-x; + } /* argument reduction needed */ else { diff --git a/sysdeps/ieee754/ldbl-128/s_tanl.c b/sysdeps/ieee754/ldbl-128/s_tanl.c index ea9d053d9b8..2349da67f1e 100644 --- a/sysdeps/ieee754/ldbl-128/s_tanl.c +++ b/sysdeps/ieee754/ldbl-128/s_tanl.c @@ -44,6 +44,7 @@ * TRIG(x) returns trig(x) nearly rounded */ +#include #include "math.h" #include "math_private.h" @@ -65,7 +66,14 @@ if(ix <= 0x3ffe921fb54442d1LL) return __kernel_tanl(x,z,1); /* tanl(Inf or NaN) is NaN */ - else if (ix>=0x7fff000000000000LL) return x-x; /* NaN */ + else if (ix>=0x7fff000000000000LL) { + if (ix == 0x7fff000000000000LL) { + GET_LDOUBLE_LSW64(n,x); + if (n == 0) + __set_errno (EDOM); + } + return x-x; /* NaN */ + } /* argument reduction needed */ else {