Backport of WL #2934: Make/find library for doing float/double

to string conversions and vice versa" 
Initial import of the dtoa.c code and custom wrappers around it 
to allow its usage from the server code. 
 
Conversion of FLOAT/DOUBLE values to DECIMAL ones or strings 
and vice versa has been significantly reworked. As the new 
algoritms are more precise than the older ones, results of such 
conversions may not always match those obtained from older 
server versions. This in turn may break compatibility for some 
applications. 
 
This patch also fixes the following bugs: 
- bug #12860 "Difference in zero padding of exponent between 
Unix and Windows" 
- bug #21497 "DOUBLE truncated to unusable value" 
- bug #26788 "mysqld (debug) aborts when inserting specific 
numbers into char fields" 
- bug #24541 "Data truncated..." on decimal type columns 
without any good reason"
This commit is contained in:
Alexey Kopytov 2009-12-22 19:23:13 +03:00
commit 12f364ece7
58 changed files with 3526 additions and 1159 deletions

View file

@ -873,14 +873,14 @@ Warning 1264 Out of range value for column 'col2' at row 1
SELECT * FROM t1;
col1 col2
-1.1e-37 0
3.4e+38 3.4e+38
3.4e38 3.4e38
-1.1e-37 0
3.4e+38 3.4e+38
3.4e38 3.4e38
0 NULL
2 NULL
NULL NULL
3.40282e+38 0
3.40282e+38 0
3.40282e38 0
3.40282e38 0
DROP TABLE t1;
CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED);
INSERT INTO t1 VALUES (-2.2E-307,0),(2E-307,0),(+1.7E+308,+1.7E+308);
@ -922,14 +922,14 @@ SELECT * FROM t1;
col1 col2
-2.2e-307 0
1e-303 0
NULL 1.7e+308
NULL 1.7e308
-2.2e-307 0
-2e-307 0
NULL 1.7e+308
NULL 1.7e308
0 NULL
2 NULL
NULL NULL
1.79769313486232e+308 0
1.7976931348623157e308 0
DROP TABLE t1;
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');