diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-21 22:22:47 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-05-21 22:22:47 +0500 |
commit | 6fe492d47913075ee9c284dc4be685b14cd5e67a (patch) | |
tree | 97cd5e0068c8bfdcd0bbf524552be2778b2e1e63 /mysql-test | |
parent | 83f03a5ffaedf91a77e044eb436a29931fda520b (diff) | |
download | mariadb-git-6fe492d47913075ee9c284dc4be685b14cd5e67a.tar.gz |
Bug #27984 Long Decimal Maths produces truncated results.
decimal_round failed to perform a correct rounding
of a decimal number if its first nine digits were '9'.
It just sets those digits to 0.
mysql-test/r/type_newdecimal.result:
Bug #27984 Long Decimal Maths produces truncated results.
test result
mysql-test/t/type_newdecimal.test:
Bug #27984 Long Decimal Maths produces truncated results.
test case
strings/decimal.c:
Bug #27984 Long Decimal Maths produces truncated results.
when to == from we break the data if we do to->buf[0]=0
So now doing this after the data is moved and only
if we really need to set to->buf[0] to zero
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/type_newdecimal.result | 3 | ||||
-rw-r--r-- | mysql-test/t/type_newdecimal.test | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index cbcab126439..92a5e4fc39c 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1465,4 +1465,7 @@ Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at r Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1 +SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; +a b +0.9999999999999800000000000000 0.9999999999999800000000000000 End of 5.0 tests diff --git a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test index a7906be79d4..3a62db1bfd7 100644 --- a/mysql-test/t/type_newdecimal.test +++ b/mysql-test/t/type_newdecimal.test @@ -1149,4 +1149,9 @@ select cast(a as DECIMAL(3,2)), count(*) UNION select 12.1234 ) t group by 1; +# +# Bug #27984 Long Decimal Maths produces truncated results +# + +SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; --echo End of 5.0 tests |