MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Botchkov Date:December 16 2009 12:16pm
Subject:bzr commit into mysql-5.5-next-mr-bugfixing branch (holyfoot:2940)
Bug#36829
View as plain text  
#At file:///home/hf/work/mysql_common/36829/ based on revid:holyfoot@stripped

 2940 Alexey Botchkov	2009-12-16
      Bug#36829      Decimal to double conversion is inaccurate
          it's the 'string to double' conversion that isn't accurate here.
          if we use 'long double' instead of the 'double' to accumulate the
          result, the precision isn't lost.
          The 'double to string' conversion still isn't fixed in this case, but
          that's how it was in 4.0
      
      per-file comments:
        strings/strtod.c
      Bug#36829      Decimal to double conversion is inaccurate
         long double used to accumulate the result

    modified:
      strings/strtod.c
=== modified file 'strings/strtod.c'
--- a/strings/strtod.c	2007-08-13 13:11:25 +0000
+++ b/strings/strtod.c	2009-12-16 12:15:21 +0000
@@ -85,14 +85,14 @@ const double log_10[] = {
 
 double my_strtod(const char *str, char **end_ptr, int *error)
 {
-  double result= 0.0;
+  long double result= 0.0;
   uint negative= 0, neg_exp= 0;
   size_t ndigits, dec_digits= 0;
   int exponent= 0, digits_after_dec_point= 0, tmp_exp, step;
   const char *old_str, *end= *end_ptr, *start_of_number;
   char next_char;
   my_bool overflow=0;
-  double scaler= 1.0;
+  long double scaler= 1.0;
 
   *error= 0;
   if (str >= end)
@@ -194,7 +194,7 @@ double my_strtod(const char *str, char *
       order= -order;
     if (order >= MAX_DBL_EXP && !neg_exp && result)
     {
-      double c;
+      long double c;
       /* Compute modulus of C (see comment above) */
       c= result / scaler * 10.0;
       if (order > MAX_DBL_EXP || c > MAX_RESULT_FOR_MAX_EXP)


Attachment: [text/bzr-bundle] bzr/holyfoot@mysql.com-20091216121521-34dzce2u0fu2vrlv.bundle
Thread
bzr commit into mysql-5.5-next-mr-bugfixing branch (holyfoot:2940)Bug#36829Alexey Botchkov17 Dec