diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 3171836d7..4c6c2435a 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,9 @@ +2005-09-08 Brian Dessent + + * sf_lrint.c (lrintf): Mask 'i0' correctly when extracting + mantissa. + * s_lrint.c: Ditto. + 2005-09-02 Jeff Johnston * libc/include/stdio.h: Add prototype for viprintf. diff --git a/newlib/libm/common/s_lrint.c b/newlib/libm/common/s_lrint.c index 45759f194..7d3b561b1 100644 --- a/newlib/libm/common/s_lrint.c +++ b/newlib/libm/common/s_lrint.c @@ -83,7 +83,8 @@ TWO52[2]={ else if (j0 < (int)(8 * sizeof (long int)) - 1) { if (j0 >= 52) - result = ((long int) i0 << (j0 - 20)) | (i1 << (j0 - 52)); + result = ((long int) ((i0 & 0x000fffff) | 0x0010000) << (j0 - 20)) | + (i1 << (j0 - 52)); else { w = TWO52[sx] + x; diff --git a/newlib/libm/common/sf_lrint.c b/newlib/libm/common/sf_lrint.c index 427bbb655..3165705d1 100644 --- a/newlib/libm/common/sf_lrint.c +++ b/newlib/libm/common/sf_lrint.c @@ -63,7 +63,7 @@ TWO23[2]={ if (j0 < -1) return 0; else if (j0 >= 23) - result = (long int) i0 << (j0 - 23); + result = (long int) ((i0 & 0x7fffff) | 0x800000) << (j0 - 23); else { w = TWO23[sx] + x;