This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ceill() for ldbl-96


Hi,

ceil(x) is defined so that ceil(x) = n / n - 1 < x <= n, where n is
integral, x a real number. The following patch fixes this for ldbl-96 
targets (e.g. AMD64), in particular ceill(0.25).

2003-11-12  Gwenole Beauchesne  <gbeauchesne@mandrakesoft.com>

	* sysdeps/ieee754/ldbl-96/s_ceill.c (__ceill): Fix 0 < x < 1 case.
	
--- glibc-2.3.2/sysdeps/ieee754/ldbl-96/s_ceill.c.ceill-fix	2000-10-01 00:01:23.000000000 +0200
+++ glibc-2.3.2/sysdeps/ieee754/ldbl-96/s_ceill.c	2003-11-12 23:45:59.000000000 +0100
@@ -50,9 +50,10 @@ static long double huge = 1.0e4930;
 	j0 = (se&0x7fff)-0x3fff;
 	if(j0<31) {
 	    if(j0<0) { 	/* raise inexact if x != 0 */
-		if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */
-		    if(sx) {se=0x8000;i0=0;i1=0;}
-		    else if((i0|i1)!=0) { se=0x3fff;i0=0;i1=0;}
+		if(huge+x>0.0) {
+		  /* return -0.0 if -1 < x < 0, 1.0 if 0 < x < 1.0 */
+		  if(sx) {se=0x8000;i0=0;i1=0;}
+		  else if((i0|i1)!=0) { se=0x3fff;i0=0x80000000;i1=0;}
 		}
 	    } else {
 		i = (0x7fffffff)>>j0;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]