about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2006-01-31 18:56:42 +0000
committerRoland McGrath <roland@gnu.org>2006-01-31 18:56:42 +0000
commit16f0ecedb5726fa46fac6a73b633aabcf469962d (patch)
treeb58989963f24a39fb71398dbf90c8d6f67f9f421 /sysdeps/ieee754/ldbl-128ibm/s_ceill.c
parent27d7e3b54c07b8eff35d2ff07ff9eb8ea03c853e (diff)
downloadglibc-16f0ecedb5726fa46fac6a73b633aabcf469962d.tar.gz
glibc-16f0ecedb5726fa46fac6a73b633aabcf469962d.tar.xz
glibc-16f0ecedb5726fa46fac6a73b633aabcf469962d.zip
* sysdeps/ieee754/ldbl-128ibm/k_cosl.c (__kernel_cosl): Correct index
	for __sincosl_table.
	* sysdeps/ieee754/ldbl-128ibm/k_sincosl.c (__kernel_sincosl): Likewise.
	* sysdeps/ieee754/ldbl-128ibm/k_sinl.c (__kernel_sinl): Likewise.

	* sysdeps/ieee754/ldbl-128ibm/s_ceill.c: Correct sign of 0.0.
	* sysdeps/ieee754/ldbl-128ibm/s_floorl.c: Likewise.

	* sysdeps/ieee754/ldbl-128ibm/s_cprojl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_ctanhl.c: New file.
	* sysdeps/ieee754/ldbl-128ibm/s_ctanl.c: New file.
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm/s_ceill.c')
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_ceill.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
index a4cbbe1048..a606548873 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c
@@ -18,9 +18,6 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* This has been coded in assembler because GCC makes such a mess of it
-   when it's coded in C.  */
-
 #include <math.h>
 #include <fenv.h>
 #include <math_ldbl_opt.h>
@@ -44,19 +41,23 @@ __ceill (x)
   u.d = x;
 
   if (fabs (u.dd[0]) < TWO52)
-    {      
+    {
+      double high = u.dd[0];
       fesetround(FE_UPWARD);
-      if (u.dd[0] > 0.0)
+      if (high > 0.0)
 	{
-	  u.dd[0] += TWO52;
-	  u.dd[0] -= TWO52;
+	  high += TWO52;
+	  high -= TWO52;
+          if (high == -0.0) high = 0.0;
 	}
-      else if (u.dd[0] < 0.0)
+      else if (high < 0.0)
 	{
-	  u.dd[0] -= TWO52;
-	  u.dd[0] += TWO52;
+	  high -= TWO52;
+	  high += TWO52;
+          if (high == 0.0) high = -0.0;
 	}
-      u.dd[1] = 0.0;      
+      u.dd[0] = high;
+      u.dd[1] = 0.0;
       fesetround(mode);
     }
   else if (fabs (u.dd[1]) < TWO52 && u.dd[1] != 0.0)
@@ -82,10 +83,10 @@ __ceill (x)
 	         adjust for that.  */
 	      high = nextafter (u.dd[0], 0.0);
 	      low = u.dd[1] + (u.dd[0] - high);
-	    }      
+	    }
           fesetround(FE_UPWARD);
 	  low += TWO52;
-	  low -= TWO52;     
+	  low -= TWO52;
           fesetround(mode);
 	}
       else if (u.dd[0] < 0.0)
@@ -103,10 +104,10 @@ __ceill (x)
 	         adjust for that.  */
 	      high = nextafter (u.dd[0], 0.0);
 	      low = u.dd[1] + (u.dd[0] - high);
-	    }      
+	    }
           fesetround(FE_UPWARD);
 	  low -= TWO52;
-	  low += TWO52;      
+	  low += TWO52;
           fesetround(mode);
 	}
       u.dd[0] = high + low;