aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
Diffstat (limited to 'newlib')
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libm/common/s_lrint.c3
-rw-r--r--newlib/libm/common/sf_lrint.c2
3 files changed, 9 insertions, 2 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 3171836..4c6c243 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-08 Brian Dessent <brian@dessent.net>
+
+ * sf_lrint.c (lrintf): Mask 'i0' correctly when extracting
+ mantissa.
+ * s_lrint.c: Ditto.
+
2005-09-02 Jeff Johnston <jjohnstn@redhat.com>
* 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 45759f1..7d3b561 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 427bbb6..3165705 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;