Commit 32226588 authored by unknown's avatar unknown

Merge mysql.com:/home/hf/work/27984/my50-27984

into  mysql.com:/home/hf/work/27984/my51-27984


mysql-test/t/type_newdecimal.test:
  Auto merged
strings/decimal.c:
  Auto merged
mysql-test/r/type_newdecimal.result:
  merging
parents d200346e cfb9378b
...@@ -1475,6 +1475,9 @@ Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 ...@@ -1475,6 +1475,9 @@ Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1
Error 1264 Out of range value for column 'cast(a as DECIMAL(3,2))' at row 1 Error 1264 Out of range value 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 End of 5.0 tests
select cast(143.481 as decimal(4,1)); select cast(143.481 as decimal(4,1));
cast(143.481 as decimal(4,1)) cast(143.481 as decimal(4,1))
......
...@@ -1159,6 +1159,11 @@ select cast(a as DECIMAL(3,2)), count(*) ...@@ -1159,6 +1159,11 @@ select cast(a as DECIMAL(3,2)), count(*)
UNION select 12.1234 UNION select 12.1234
) t group by 1; ) 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 --echo End of 5.0 tests
# #
......
...@@ -1523,9 +1523,10 @@ decimal_round(decimal_t *from, decimal_t *to, int scale, ...@@ -1523,9 +1523,10 @@ decimal_round(decimal_t *from, decimal_t *to, int scale,
dec1 *p0= buf0+intg0+max(frac1, frac0); dec1 *p0= buf0+intg0+max(frac1, frac0);
dec1 *p1= buf1+intg1+max(frac1, frac0); dec1 *p1= buf1+intg1+max(frac1, frac0);
to->buf[0]= 0;
while (buf0 < p0) while (buf0 < p0)
*(--p1) = *(--p0); *(--p1) = *(--p0);
if (unlikely(intg1 > intg0))
to->buf[0]= 0;
intg0= intg1; intg0= intg1;
buf0=to->buf; buf0=to->buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment