diff options
author | serg@build.mysql.com <> | 2004-02-27 14:40:08 +0100 |
---|---|---|
committer | serg@build.mysql.com <> | 2004-02-27 14:40:08 +0100 |
commit | d0b0e5bf7741be0ed647fa285e56b55ac1c688a1 (patch) | |
tree | 48ae627b412e8309d8d11ffd3c565f967dff1baa | |
parent | 743bc4628aa7d298e0dfad328884076b60e5ebd8 (diff) | |
download | mariadb-git-d0b0e5bf7741be0ed647fa285e56b55ac1c688a1.tar.gz |
do not use static array of pastpoints in my_strtod - it is not portable
(that is, these numbers are converted to doubles by a local OS strtod,
and on different systems they get different values)
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 2 | ||||
-rw-r--r-- | strings/strtod.c | 20 |
3 files changed, 4 insertions, 19 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 1f05efb9b08..f9577075ede 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -121,6 +121,7 @@ salle@geopard.online.bg salle@vafla.home salle@vafla.online.bg sasha@mysql.sashanet.com +serg@build.mysql.com serg@build.mysql2.com serg@serg.mylan serg@serg.mysql.com diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ed6e44262c7..3d847a1216a 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1599,10 +1599,8 @@ String *Item_func_format::val_str(String *str) dec= decimals ? decimals+1 : 0; /* Here default_charset() is right as this is not an automatic conversion */ str->set(nr,decimals, default_charset()); -#ifdef HAVE_ISNAN if (isnan(nr)) return str; -#endif str_length=str->length(); if (nr < 0) str_length--; // Don't count sign diff --git a/strings/strtod.c b/strings/strtod.c index 5b3be40cbf8..027abe56269 100644 --- a/strings/strtod.c +++ b/strings/strtod.c @@ -36,16 +36,6 @@ static double scaler1[] = { 1.0, 10.0, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9 }; -/* let's use a static array for not to accumulate the error */ -static double pastpoint[] = { - 1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8, 1e-9, - 1e-10, 1e-11, 1e-12, 1e-13, 1e-14, 1e-15, 1e-16, 1e-17, 1e-18, 1e-19, - 1e-20, 1e-21, 1e-22, 1e-23, 1e-24, 1e-25, 1e-26, 1e-27, 1e-28, 1e-29, - 1e-30, 1e-31, 1e-32, 1e-33, 1e-34, 1e-35, 1e-36, 1e-37, 1e-38, 1e-39, - 1e-40, 1e-41, 1e-42, 1e-43, 1e-44, 1e-45, 1e-46, 1e-47, 1e-48, 1e-49, - 1e-50, 1e-51, 1e-52, 1e-53, 1e-54, 1e-55, 1e-56, 1e-57, 1e-58, 1e-59, -}; - double my_strtod(const char *str, char **end) { double result= 0.0; @@ -68,17 +58,13 @@ double my_strtod(const char *str, char **end) if (*str == '.') { - int n= 0; + double p10=10; str++; old_str= str; while (my_isdigit (&my_charset_latin1, *str)) { - if (n < sizeof(pastpoint)/sizeof(pastpoint[0])) - { - result+= pastpoint[n] * (*str - '0'); - n++; - } - str++; + result+= (*str++ - '0')/p10; + p10*=10; } ndigits+= str-old_str; if (!ndigits) str--; |