Author: das
Date: Sat Apr 21 07:00:00 2012
New Revision: 234534
URL: http://svn.freebsd.org/changeset/base/234534

Log:
  MFC r233973:
    Fix bugs in remquo{,f,l}.

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

Modified: stable/8/lib/msun/src/s_remquo.c
==============================================================================
--- stable/8/lib/msun/src/s_remquo.c    Sat Apr 21 06:59:48 2012        
(r234533)
+++ stable/8/lib/msun/src/s_remquo.c    Sat Apr 21 07:00:00 2012        
(r234534)
@@ -51,7 +51,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*/
            }
        }
@@ -114,6 +114,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];
        }
@@ -129,9 +130,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/8/lib/msun/src/s_remquof.c
==============================================================================
--- stable/8/lib/msun/src/s_remquof.c   Sat Apr 21 06:59:48 2012        
(r234533)
+++ stable/8/lib/msun/src/s_remquof.c   Sat Apr 21 07:00:00 2012        
(r234534)
@@ -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];
        }

Modified: stable/8/lib/msun/src/s_remquol.c
==============================================================================
--- stable/8/lib/msun/src/s_remquol.c   Sat Apr 21 06:59:48 2012        
(r234533)
+++ stable/8/lib/msun/src/s_remquol.c   Sat Apr 21 07:00:00 2012        
(r234534)
@@ -96,7 +96,7 @@ remquol(long double x, long double y, in
                goto fixup;     /* |x|<|y| return x or x-y */
            }
            if(ux.bits.manh==uy.bits.manh && ux.bits.manl==uy.bits.manl) {
-               *quo = 1;
+               *quo = (sxy ? -1 : 1);
                return Zero[sx];        /* |x|=|y| return x*0*/
            }
        }
@@ -138,6 +138,7 @@ remquol(long double x, long double y, in
 
     /* 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[sx];
        }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to