OSDN Git Service

2006-08-03 J"orn Rennecke <joern.rennecke@st.com>
authorjjohnstn <jjohnstn>
Thu, 3 Aug 2006 16:56:05 +0000 (16:56 +0000)
committerjjohnstn <jjohnstn>
Thu, 3 Aug 2006 16:56:05 +0000 (16:56 +0000)
        * dtoa.c (dtoa_r): Handle the denormalized _DOUBLE_IS_32BITS case
        properly.

newlib/ChangeLog
newlib/libc/stdlib/dtoa.c

index 31df6ad..f593208 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-03  J"orn Rennecke  <joern.rennecke@st.com>
+
+       * dtoa.c (dtoa_r): Handle the denormalized _DOUBLE_IS_32BITS case
+       properly.
+
 2006-08-01  Jeff Johnston  <jjohnstn@redhat.com>
 
        * libc/Makefile.am: Add libc_TEXINFOS dependency on
index 62597c7..c72ffac 100644 (file)
@@ -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) */