[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r12265 - in /libdfp/trunk: ChangeLog strtod32.c tests/test-strtod.c



Author: luis
Date: Fri Dec 10 02:56:24 2010
New Revision: 12265

Log:
2010-12-10  Luis Machado  <luisgpm@xxxxxxxxxx>

	* strtod32.c: Fix precedence of arithmetic operation.
	* tests/test-strtod.c: Add new testcase and fix wrong tests.


Modified:
    libdfp/trunk/ChangeLog
    libdfp/trunk/strtod32.c
    libdfp/trunk/tests/test-strtod.c

Modified: libdfp/trunk/ChangeLog
==============================================================================
--- libdfp/trunk/ChangeLog (original)
+++ libdfp/trunk/ChangeLog Fri Dec 10 02:56:24 2010
@@ -1,3 +1,8 @@
+2010-12-10  Luis Machado  <luisgpm@xxxxxxxxxx>
+
+	* strtod32.c: Fix precedence of arithmetic operation.
+	* tests/test-strtod.c: Add new testcase and fix wrong tests.
+
 2010-12-03  Ryan S. Arnold  <rsa@xxxxxxxxxx>
 
 	* configure: Regenerated.

Modified: libdfp/trunk/strtod32.c
==============================================================================
--- libdfp/trunk/strtod32.c (original)
+++ libdfp/trunk/strtod32.c Fri Dec 10 02:56:24 2010
@@ -912,7 +912,7 @@
 	      }
 #endif
 	  if(base == 10)
-	    d32 = d32 * base + *startp - L_('0');
+	    d32 = d32 * base + (*startp - L_('0'));
 	  else
 	    d32 = d32 * base + (*startp >= L_('0') && *startp <= L_('9') ?
 			-L_('0') : 10-L_('a')) + *startp;
@@ -959,7 +959,7 @@
 	if (int_no < MANT_DIG)
 	  {
 	    if(base == 10)
-	      d32 = d32*10 + *startp - L_('0');
+	      d32 = d32*10 + (*startp - L_('0'));
 	    else
 	      d32 = d32*10 + (*startp >= L_('0') &&
 		*startp <= L_('9') ? -L_('0') : 10-L_('a'))

Modified: libdfp/trunk/tests/test-strtod.c
==============================================================================
--- libdfp/trunk/tests/test-strtod.c (original)
+++ libdfp/trunk/tests/test-strtod.c Fri Dec 10 02:56:24 2010
@@ -61,10 +61,11 @@
   {__LINE__, "0.1", 0.1DF, 0.1DD, 0.1DL },
   {__LINE__, "0.11", 0.11DF, 0.11DD, 0.11DL },
   {__LINE__, "0.21", 0.21DF, 0.21DD, 0.21DL },
+  {__LINE__, "0.9999999", 0.9999999DF, 0.9999999DD, 0.9999999DL },
   {__LINE__, "19e9", 19000000000.0DF, 19000000000.0DD, 19000000000.0DL },
   {__LINE__, "3.14", 3.140000DF, 3.140000DD, 3.140000DL },
   {__LINE__, "3.14e-2", 0.031400DF, 0.031400DD, 0.031400DL },
-  {__LINE__, "1234.5678910111213e-5", 0.01234568DF ,0.01234567891011121DD ,0.012345678910111213DL },
+  {__LINE__, "1234.5678910111213e-5", 0.01234567DF ,0.01234567891011121DD ,0.012345678910111213DL },
   {0,0,0,0,0 }
 };
 
@@ -86,8 +87,8 @@
   /* Compare against the decoded declet for each representation of DEC_NAN since
    * since you can't compare DEC_NAN to DEC_NAN.  */
   {__LINE__, "NaN", DECLET32_NAN, DECLET64_NAN, DECLET128_NAN},
-  {__LINE__, "1.23456789E-7", "+1,234,568E-13",        "+0,000,000,123,456,789E-15", "+0,000,000,000,000,000,000,000,000,123,456,789E-15" },
-  {__LINE__, "1234.5678910111213e-5", "+1,234,568E-8", "+1,234,567,891,011,121E-17", "+0,000,000,000,000,000,012,345,678,910,111,213E-18" },
+  {__LINE__, "1.23456789E-7", "+1,234,567E-13", "+0,000,000,123,456,789E-15", "+0,000,000,000,000,000,000,000,000,123,456,789E-15" },
+  {__LINE__, "1234.5678910111213e-5", "+1,234,567E-8", "+1,234,567,891,011,121E-17", "+0,000,000,000,000,000,012,345,678,910,111,213E-18" },
   {0,0,0,0,0 }
 };