]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Fix errno for boundary conditions in 128-bit long double.
authorUlrich Drepper <drepper@redhat.com>
Fri, 29 May 2009 19:00:22 +0000 (12:00 -0700)
committerPetr Baudis <pasky@suse.cz>
Fri, 5 Jun 2009 21:04:22 +0000 (23:04 +0200)
Similar to the changes which went already in for the other formats,
follow POSIX rules for errno.
(cherry picked from commit 7f3394bdf34e28b374e5569a7a74ddac734fb172)

ChangeLog
sysdeps/ieee754/ldbl-128/s_cosl.c
sysdeps/ieee754/ldbl-128/s_expm1l.c
sysdeps/ieee754/ldbl-128/s_sinl.c
sysdeps/ieee754/ldbl-128/s_tanl.c

index 10ac72dcd5cf10f060a0667f1725d5bf5af68b4b..7f28993a678f7a0a2c7ded7bbdcb2b5e7c1b2ae4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2009-05-29  Jakub Jelinek  <jakub@redhat.com>
+
+       * sysdeps/ieee754/ldbl-128/s_expm1l.c: Include <errno.h>.
+       (__expm1l): Set errno to ERANGE on overflow.
+       * sysdeps/ieee754/ldbl-128/s_tanl.c: Include <errno.h>.
+       (__tanl): Set errno to EDOM for ±Inf.
+       * sysdeps/ieee754/ldbl-128/s_cosl.c: Include <errno.h>.
+       (__cosl): Set errno to EDOM for ±Inf.
+       * sysdeps/ieee754/ldbl-128/s_sinl.c: Include <errno.h>.
+       (__sinl): Set errno to EDOM for ±Inf.
+
 2009-05-22  Andreas Schwab  <schwab@linux-m68k.org>
 
        * sysdeps/ieee754/ldbl-128ibm/s_sinl.c: Set errno for ±Inf.
index d1258b2cf15219eeceb8acb869018d17e5174649..ef61c3afdb715f8db08a77ae98d3db547dcbb2d9 100644 (file)
@@ -44,6 +44,7 @@
  *     TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
          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 {
index 78bbe65b53701f2496fb145091d0cf93023a973c..a82489bb24867d1a12f33d59ed49e8d9a271cc8f 100644 (file)
@@ -53,6 +53,7 @@
 
 
 
+#include <errno.h>
 #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)
index 446a75f126ca013430d69bbfd6d5e0313768db71..dc509e72e52e8694e83e90766913889580084e57 100644 (file)
@@ -44,6 +44,7 @@
  *     TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
          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 {
index ea9d053d9b81bcb7d30866b1aa52e74cb0068ceb..2349da67f1ef5b93563c18b6331d10308172c352 100644 (file)
@@ -44,6 +44,7 @@
  *     TRIG(x) returns trig(x) nearly rounded
  */
 
+#include <errno.h>
 #include "math.h"
 #include "math_private.h"
 
        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 {