Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2006-08-03 20:56:05 +0400
committerJeff Johnston <jjohnstn@redhat.com>2006-08-03 20:56:05 +0400
commit079b45dc00db5035925df22de0a117c6638d2496 (patch)
tree4fa1788a19291508bfd7d5567a86f744867bc502 /newlib/libc/stdlib
parentfb43e6237c2c7a9d81017a7f6254035afb04c633 (diff)
2006-08-03 J"orn Rennecke <joern.rennecke@st.com>
* dtoa.c (dtoa_r): Handle the denormalized _DOUBLE_IS_32BITS case properly.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/dtoa.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/dtoa.c b/newlib/libc/stdlib/dtoa.c
index 62597c755..c72ffac5e 100644
--- a/newlib/libc/stdlib/dtoa.c
+++ b/newlib/libc/stdlib/dtoa.c
@@ -338,15 +338,23 @@ _DEFUN (_dtoa_r,
/* d is denormalized */
i = bbits + be + (Bias + (P - 1) - 1);
+#if defined (_DOUBLE_IS_32BITS)
+ x = word0 (d) << (32 - i);
+#else
x = (i > 32) ? (word0 (d) << (64 - i)) | (word1 (d) >> (i - 32))
: (word1 (d) << (32 - i));
+#endif
d2.d = x;
word0 (d2) -= 31 * Exp_msk1; /* adjust exponent */
i -= (Bias + (P - 1) - 1) + 1;
denorm = 1;
}
#endif
+#if defined (_DOUBLE_IS_32BITS)
+ ds = (d2.d - 1.5) * 0.289529651 + 0.176091269 + i * 0.30103001;
+#else
ds = (d2.d - 1.5) * 0.289529654602168 + 0.1760912590558 + i * 0.301029995663981;
+#endif
k = (int) ds;
if (ds < 0. && ds != k)
k--; /* want k = floor(ds) */