Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Apr 2012 06:59:48 +0000 (UTC)
From:      David Schultz <das@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r234533 - stable/7/lib/msun/src
Message-ID:  <201204210659.q3L6xnek076165@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: das
Date: Sat Apr 21 06:59:48 2012
New Revision: 234533
URL: http://svn.freebsd.org/changeset/base/234533

Log:
  MFC r233973 (partial):
    Fix bugs in remquo{,f}.

Modified:
  stable/7/lib/msun/src/s_remquo.c
  stable/7/lib/msun/src/s_remquof.c
Directory Properties:
  stable/7/lib/msun/   (props changed)

Modified: stable/7/lib/msun/src/s_remquo.c
==============================================================================
--- stable/7/lib/msun/src/s_remquo.c	Sat Apr 21 06:29:44 2012	(r234532)
+++ stable/7/lib/msun/src/s_remquo.c	Sat Apr 21 06:59:48 2012	(r234533)
@@ -49,7 +49,7 @@ remquo(double x, double y, int *quo)
 		goto fixup;	/* |x|<|y| return x or x-y */
 	    }
 	    if(lx==ly) {
-		*quo = 1;
+		*quo = (sxy ? -1 : 1);
 		return Zero[(u_int32_t)sx>>31];	/* |x|=|y| return x*0*/
 	    }
 	}
@@ -112,6 +112,7 @@ remquo(double x, double y, int *quo)
 
     /* convert back to floating value and restore the sign */
 	if((hx|lx)==0) {			/* return sign(x)*0 */
+	    q &= 0x7fffffff;
 	    *quo = (sxy ? -q : q);
 	    return Zero[(u_int32_t)sx>>31];
 	}
@@ -127,9 +128,9 @@ remquo(double x, double y, int *quo)
 		lx = (lx>>n)|((u_int32_t)hx<<(32-n));
 		hx >>= n;
 	    } else if (n<=31) {
-		lx = (hx<<(32-n))|(lx>>n); hx = sx;
+		lx = (hx<<(32-n))|(lx>>n); hx = 0;
 	    } else {
-		lx = hx>>(n-32); hx = sx;
+		lx = hx>>(n-32); hx = 0;
 	    }
 	}
 fixup:

Modified: stable/7/lib/msun/src/s_remquof.c
==============================================================================
--- stable/7/lib/msun/src/s_remquof.c	Sat Apr 21 06:29:44 2012	(r234532)
+++ stable/7/lib/msun/src/s_remquof.c	Sat Apr 21 06:59:48 2012	(r234533)
@@ -46,7 +46,7 @@ remquof(float x, float y, int *quo)
 	    q = 0;
 	    goto fixup;	/* |x|<|y| return x or x-y */
 	} else if(hx==hy) {
-	    *quo = 1;
+	    *quo = (sxy ? -1 : 1);
 	    return Zero[(u_int32_t)sx>>31];	/* |x|=|y| return x*0*/
 	}
 
@@ -88,6 +88,7 @@ remquof(float x, float y, int *quo)
 
     /* convert back to floating value and restore the sign */
 	if(hx==0) {				/* return sign(x)*0 */
+	    q &= 0x7fffffff;
 	    *quo = (sxy ? -q : q);
 	    return Zero[(u_int32_t)sx>>31];
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204210659.q3L6xnek076165>