libm: remainder: make sure x is zero
Make sure the entirety of x is zero before flipping the sign bit. Otherwise the sign would be wrong for small values of x when x is negative and |n*y| > |x| Reported by: alfredo PR: 251091 Reviewed by: kargl MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D53023
This commit is contained in:
@@ -64,8 +64,8 @@ remainder(double x, double p)
|
|||||||
if(x>=p_half) x -= p;
|
if(x>=p_half) x -= p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GET_HIGH_WORD(hx,x);
|
EXTRACT_WORDS(hx, lx, x);
|
||||||
if ((hx&0x7fffffff)==0) hx = 0;
|
if (((hx&0x7fffffff)|lx) == 0) hx = 0;
|
||||||
SET_HIGH_WORD(x,hx^sx);
|
SET_HIGH_WORD(x,hx^sx);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user