MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:December 1 2007 12:25pm
Subject:bk commit into 5.0 tree (kaa:1.2529)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kaa. When kaa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-12-01 15:25:24+03:00, kaa@polly.(none) +4 -0
  Fixed the floating point number tests on Windows.

  mysql-test/r/insert.result@stripped, 2007-12-01 15:25:21+03:00, kaa@polly.(none) +12 -12
    Fixed the test cases.

  mysql-test/t/cast.test@stripped, 2007-12-01 15:25:21+03:00, kaa@polly.(none) +2 -0
    We need to do replace_result because warnings are printed by another procedure.

  mysql-test/t/insert.test@stripped, 2007-12-01 15:25:21+03:00, kaa@polly.(none) +3 -1
    Windows implements a different rounding rules in printf("%g"), thus we still need to do replace_result.

  sql/field.cc@stripped, 2007-12-01 15:25:21+03:00, kaa@polly.(none) +1 -1
    Limit the precision to avoid garbage past the significant digits.

diff -Nrup a/mysql-test/r/insert.result b/mysql-test/r/insert.result
--- a/mysql-test/r/insert.result	2007-12-01 10:05:54 +03:00
+++ b/mysql-test/r/insert.result	2007-12-01 15:25:21 +03:00
@@ -500,23 +500,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
@@ -554,23 +554,23 @@ INSERT INTO t1(a,c) VALUES (5000e+0, 500
 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
diff -Nrup a/mysql-test/t/cast.test b/mysql-test/t/cast.test
--- a/mysql-test/t/cast.test	2007-12-01 10:05:54 +03:00
+++ b/mysql-test/t/cast.test	2007-12-01 15:25:21 +03:00
@@ -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;					   
 
diff -Nrup a/mysql-test/t/insert.test b/mysql-test/t/insert.test
--- a/mysql-test/t/insert.test	2007-12-01 10:05:54 +03:00
+++ b/mysql-test/t/insert.test	2007-12-01 15:25:21 +03:00
@@ -386,7 +386,9 @@ INSERT INTO t1(a,c) VALUES (1.87e-3, 1.8
 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;
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc	2007-12-01 12:46:22 +03:00
+++ b/sql/field.cc	2007-12-01 15:25:21 +03:00
@@ -5954,7 +5954,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__
   /*
Thread
bk commit into 5.0 tree (kaa:1.2529)Alexey Kopytov1 Dec