mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Bug#36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1
When the fractional part in a multiplication of DECIMALs overflowed, we truncated the first operand rather than the longest. Now truncating least significant places instead for more precise multiplications. (Queuing at demand of Trudy/Davi.) mysql-test/r/type_newdecimal.result: show that if we need to truncate the scale of an operand, we pick the right one (that is, we discard the least significant decimal places) mysql-test/t/type_newdecimal.test: show that if we need to truncate the scale of an operand, we pick the right one (that is, we discard the least significant decimal places) strings/decimal.c: when needing to disregard fractional parts, pick the least significant ones
This commit is contained in:
@ -1216,4 +1216,13 @@ DESC t1;
|
||||
SELECT f1 FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #36270: incorrect calculation result - works in 4.1 but not in 5.0 or 5.1
|
||||
#
|
||||
|
||||
# show that if we need to truncate the scale of an operand, we pick the
|
||||
# right one (that is, we discard the least significant decimal places)
|
||||
select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 *
|
||||
1.01500000 * 1.01500000 * 0.99500000);
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
Reference in New Issue
Block a user