List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:December 8 2007 4:32pm
Subject:bk commit into 5.2 tree (kaa:1.2603)
View as plain text  
Below is the list of changes that have just been committed into a local
5.2 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-08 19:32:40+03:00, kaa@polly.(none) +7 -0
  Post-merge fixes after merging the patch for WL #2934 to 6.0.

  include/m_string.h@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +14 -4
    Moved the MAX_DECPT_FOR_F_FORMAT definition from dtoa.c
    Define MY_GCVT_MAX_FIELD_WIDTH as the maximum possible value, not the
    maximum reasonable. There is code that requires the maximum possible
    value, e.g. MAX_DIGITS_IN_DOUBLE in spatial.cc.

  mysql-test/r/loaddata.result@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +3 -3
    Fixed test results.

  mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +1 -1
    Fixed an incorrect binary double value used to test restore from backup.

  mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +1 -1
    Fixed an incorrect binary double value used to test restore from backup.

  mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +2 -2
    Fixed test results.

  sql/spatial.cc@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +1 -22
    Use the correct constant for maximum width of double values
    representation.

  strings/dtoa.c@stripped, 2007-12-08 19:32:33+03:00, kaa@polly.(none) +0 -10
    Moved MAX_DECPT_FOR_F_FORMAT to m_string.h

diff -Nrup a/include/m_string.h b/include/m_string.h
--- a/include/m_string.h	2007-12-07 20:13:17 +03:00
+++ b/include/m_string.h	2007-12-08 19:32:33 +03:00
@@ -214,11 +214,21 @@ size_t my_gcvt(double x, my_gcvt_arg_typ
 #define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC)
 
 /*
-  The maximum reasonable field width for my_gcvt() conversion.
-  (DBL_DIG + 2) significant digits + sign + "." + "e-NNN".
-  Lower values may lead to loss of precision.
+  We want to use the 'e' format in some cases even if we have enough space
+  for the 'f' one just to mimic sprintf("%.15g") behavior for large integers,
+  and to improve it for numbers < 10^(-4).
+  That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require
+  it to be integer and be <= 10^DBL_DIG for the 'f' format to be used.
+  We don't lose precision, but make cases like "1e200" or "0.00001" look nicer.
 */
-#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 2 + 7)
+#define MAX_DECPT_FOR_F_FORMAT DBL_DIG
+
+/*
+  The maximum possible field width for my_gcvt() conversion.
+  (DBL_DIG + 2) significant digits + sign + "." + ("e-NNN" or
+  MAX_DECPT_FOR_F_FORMAT zeros for cases when |x|<1 and the 'f' format is used).
+*/
+#define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + max(5, MAX_DECPT_FOR_F_FORMAT))
   
 
 extern char *llstr(longlong value,char *buff);
diff -Nrup a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
--- a/mysql-test/r/loaddata.result	2007-07-07 19:14:04 +04:00
+++ b/mysql-test/r/loaddata.result	2007-12-08 19:32:33 +03:00
@@ -251,15 +251,15 @@ CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c
 INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
 SELECT * FROM t1;
 c1	c2	c3	c4
-10	1970-02-01 01:02:03	1.1e-100	1.1e+100
+10	1970-02-01 01:02:03	1.1e-100	1.1e100
 SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
--10-	-1970\-02\-01 01:02:03-	-1.1e\-100-	-1.1e+100-
+-10-	-1970\-02\-01 01:02:03-	-1.1e\-100-	-1.1e100-
 EOF
 TRUNCATE t1;
 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
 SELECT * FROM t1;
 c1	c2	c3	c4
-10	1970-02-01 01:02:03	1.1e-100	1.1e+100
+10	1970-02-01 01:02:03	1.1e-100	1.1e100
 DROP TABLE t1;
 CREATE TABLE t1 (a int);
 INSERT INTO t1 VALUES (1);
Binary files a/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data and b/mysql-test/std_data/ndb_backup51_data_be/BACKUP-1-0.1.Data differ
Binary files a/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data and b/mysql-test/std_data/ndb_backup51_data_le/BACKUP-1-0.2.Data differ
diff -Nrup a/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result b/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result
--- a/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result	2007-09-05 17:01:20 +04:00
+++ b/mysql-test/suite/ndb/r/ndb_restore_different_endian_data.result	2007-12-08 19:32:33 +03:00
@@ -79,7 +79,7 @@ t_pk	t_date	t_datetime	t_timestamp	t_tim
 1	1998-01-01	2006-08-10 10:11:12	2002-10-29 16:51:06	19:38:34	2155
 SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
 t_pk	hex(t_bit)	t_tinyint	t_bool	t_smallint	t_mediumint	t_int	t_bigint	t_float	t_double	t_decimal
-1	AAAAAAAAAAAAAAAA	125	1	32765	8388606	2147483647	9223372036854775807	1e+20	1e+150	331.0000000000000000
+1	AAAAAAAAAAAAAAAA	125	1	32765	8388606	2147483647	9223372036854775807	1e20	1e150	331.0000000000000000
 SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
 t_pk	t_char	t_varchar	hex(t_binary)	hex(t_varbinary)
 1	abcdefghijklmn	abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn	612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000	4100
@@ -178,7 +178,7 @@ t_pk	t_date	t_datetime	t_timestamp	t_tim
 1	1998-01-01	2006-08-10 10:11:12	2002-10-29 16:51:06	19:38:34	2155
 SELECT t_pk,hex(t_bit),t_tinyint,t_bool,t_smallint,t_mediumint,t_int,t_bigint,t_float,t_double,t_decimal FROM t_num;
 t_pk	hex(t_bit)	t_tinyint	t_bool	t_smallint	t_mediumint	t_int	t_bigint	t_float	t_double	t_decimal
-1	AAAAAAAAAAAAAAAA	125	1	32765	8388606	2147483647	9223372036854775807	1e+20	1e+150	331.0000000000000000
+1	AAAAAAAAAAAAAAAA	125	1	32765	8388606	2147483647	9223372036854775807	1e20	1e150	331.0000000000000000
 SELECT t_pk,t_char,t_varchar,hex(t_binary),hex(t_varbinary) FROM t_string_1;
 t_pk	t_char	t_varchar	hex(t_binary)	hex(t_varbinary)
 1	abcdefghijklmn	abcdefghijklmnabcdefghijklmnabcdefghijklmnabcdefghijklmn	612020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000	4100
diff -Nrup a/sql/spatial.cc b/sql/spatial.cc
--- a/sql/spatial.cc	2007-07-07 19:06:38 +04:00
+++ b/sql/spatial.cc	2007-12-08 19:32:33 +03:00
@@ -17,28 +17,7 @@
 
 #ifdef HAVE_SPATIAL
 
-/* 
-  exponential notation :
-  1   sign
-  1   number before the decimal point
-  1   decimal point
-  14  number of significant digits (see String::qs_append(double))
-  1   'e' sign
-  1   exponent sign
-  3   exponent digits
-  ==
-  22
-
-  "f" notation :
-  1   optional 0
-  1   sign
-  14  number significant digits (see String::qs_append(double) )
-  1   decimal point
-  ==
-  17
-*/
-
-#define MAX_DIGITS_IN_DOUBLE 22
+#define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH
 
 /***************************** Gis_class_info *******************************/
 
diff -Nrup a/strings/dtoa.c b/strings/dtoa.c
--- a/strings/dtoa.c	2007-12-07 19:56:11 +03:00
+++ b/strings/dtoa.c	2007-12-08 19:32:33 +03:00
@@ -24,16 +24,6 @@
 */
 #define DTOA_BUFF_SIZE (420 * sizeof(void *))
 
-/**
-  We want to use the 'e' format in some cases even if we have enough space
-  for the 'f' one just to mimic sprintf("%.15g") behavior for large integers,
-  and to improve it for numbers < 10^(-4).
-  That is, for |x| < 1 we require |x| >= 10^(-15), and for |x| > 1 we require
-  it to be integer and be <= 10^DBL_DIG for the 'f' format to be used.
-  We don't lose precision, but make cases like "1e200" or "0.00001" look nicer.
-*/
-#define MAX_DECPT_FOR_F_FORMAT DBL_DIG
-
 /* Magic value returned by dtoa() to indicate overflow */
 #define DTOA_OVERFLOW 9999
 
Thread
bk commit into 5.2 tree (kaa:1.2603)Alexey Kopytov8 Dec