diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-04-09 14:38:50 +0500 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-04-09 14:38:50 +0500 |
commit | d2e6c462c8bbc0c2d0390685a368f9e6d83b8f01 (patch) | |
tree | a0c0be35db134a9cf14f64bdfb6bd4937acf1d76 /sql/field.cc | |
parent | 53f8922307dd8504dbe14ee1ca3106cb51b5c151 (diff) | |
parent | 920abd58b2172ff39275e852924fa2dc41775f1c (diff) | |
download | mariadb-git-d2e6c462c8bbc0c2d0390685a368f9e6d83b8f01.tar.gz |
5.0-bugteam->5.1-bugteam merge
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/field.cc b/sql/field.cc index a06021bee3d..d11b509075b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -6448,13 +6448,13 @@ int Field_str::store(double nr) calculate the maximum number of significant digits if the 'f'-format would be used (+1 for decimal point if the number has a fractional part). */ - digits= max(0, (int) max_length - fractional); + digits= max(1, (int) max_length - fractional); /* If the exponent is negative, decrease digits by the number of leading zeros after the decimal point that do not count as significant digits. */ if (exp < 0) - digits= max(0, (int) digits + exp); + digits= max(1, (int) digits + exp); /* 'e'-format is used only if the exponent is less than -4 or greater than or equal to the precision. In this case we need to adjust the number of @@ -6462,7 +6462,7 @@ int Field_str::store(double nr) We also have to reserve one additional character if abs(exp) >= 100. */ if (exp >= (int) digits || exp < -4) - digits= max(0, (int) (max_length - 5 - (exp >= 100 || exp <= -100))); + digits= max(1, (int) (max_length - 5 - (exp >= 100 || exp <= -100))); /* Limit precision to DBL_DIG to avoid garbage past significant digits */ set_if_smaller(digits, DBL_DIG); |