Commit f917ca0c authored by unknown's avatar unknown

Merge polly.(none):/home/kaa/src/maint/bug26788/my50-bug26788

into  polly.(none):/home/kaa/src/maint/bug26788/my51-bug26788


mysql-test/r/insert.result:
  Auto merged
mysql-test/t/cast.test:
  Auto merged
mysql-test/t/insert.test:
  Auto merged
sql/field.cc:
  Auto merged
parents b2c7af4a cf4b8f6a
......@@ -538,23 +538,23 @@ Warnings:
Warning 1265 Data truncated for column 'c' at row 1
SELECT * FROM t1;
a b c
9.999999000000000748 10 10
9.999999 10 10
1.225e-05 1.2e-05 1e-0
0.0001225 0.00012 NULL
0.122499999999999998 0.1225 NULL
0.122587699999999994 0.12259 NULL
0.1225 0.1225 NULL
0.1225877 0.12259 NULL
12.25 12.25 NULL
12.25 12.25 12.2
122500 122500 NULL
12250000000 1.2e+10 NULL
1225000000000000 1.2e+15 NULL
1.225e+15 1.2e+15 NULL
5000000 5000000 NULL
1.25e+78 1.2e+78 NULL
1.25e-94 1.2e-94 NULL
1.25e+203 1e+203 NULL
1.25e-175 1e-175 NULL
1.225000000000000089 NULL 1.23
1.370000000000000107 NULL 1.37
1.225 NULL 1.23
1.37 NULL 1.37
-1.37 NULL -1.3
0.00187 NULL 0.00
-0.0187 NULL -0.0
......@@ -592,23 +592,23 @@ INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
SELECT * FROM t1;
a b c
9.999999000000000748 10 9.999
9.999999 10 9.999
1.225e-05 1.2e-05 1e-05
0.0001225 0.00012 NULL
0.122499999999999998 0.1225 NULL
0.122587699999999994 0.12259 NULL
0.1225 0.1225 NULL
0.1225877 0.12259 NULL
12.25 12.25 NULL
12.25 12.25 12.25
122500 122500 NULL
12250000000 1.2e+10 NULL
1225000000000000 1.2e+15 NULL
1.225e+15 1.2e+15 NULL
5000000 5000000 NULL
1.25e+78 1.2e+78 NULL
1.25e-94 1.2e-94 NULL
1.25e+203 1e+203 NULL
1.25e-175 1e-175 NULL
1.225000000000000089 NULL 1.225
1.370000000000000107 NULL 1.37
1.225 NULL 1.225
1.37 NULL 1.37
-1.37 NULL -1.37
0.00187 NULL 0.002
-0.0187 NULL -0.01
......
......@@ -177,6 +177,8 @@ select cast(1.0e+300 as signed int);
CREATE TABLE t1 (f1 double);
INSERT INTO t1 SET f1 = -1.0e+30 ;
INSERT INTO t1 SET f1 = +1.0e+30 ;
# Expected result is +-1e+30, but Windows returns +-1e+030.
--replace_result 1e+030 1e+30
SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
DROP TABLE t1;
......
......@@ -420,7 +420,9 @@ INSERT INTO t1(a,c) VALUES (1.87e-3, 1.87e-3);
INSERT INTO t1(a,c) VALUES (-1.87e-2, -1.87e-2);
INSERT INTO t1(a,c) VALUES (5000e+0, 5000e+0);
INSERT INTO t1(a,c) VALUES (-5000e+0, -5000e+0);
# Expected results are "12.2" and "1.2e+78", but Windows returns "12.3" and
# "1.3e+78" due to different rounding rules
--replace_result 12.3 12.2 1.3e+78 1.2e+78
SELECT * FROM t1;
DROP TABLE t1;
......
......@@ -6306,7 +6306,7 @@ int Field_str::store(double nr)
if (exp >= (int) digits || exp < -4)
digits= max(0, (int) (max_length - 5 - (exp >= 100 || exp <= -100)));
length= (uint) my_sprintf(buff, (buff, "%-.*g", digits, nr));
length= (uint) my_sprintf(buff, (buff, "%-.*g", min(digits, DBL_DIG ), nr));
#ifdef __WIN__
/*
......
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