mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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:
@@ -61,7 +61,7 @@ grp sum
|
||||
NULL NULL
|
||||
1 7
|
||||
2 20.25
|
||||
3 45.4831632475944
|
||||
3 45.48316324759439
|
||||
create table t2 (grp int, a bigint unsigned, c char(10));
|
||||
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
|
||||
replace into t2 select grp, a, c from t1 limit 2,1;
|
||||
@@ -891,7 +891,7 @@ select 1e8 * sum(distinct df) from t1;
|
||||
330000000
|
||||
select 1e8 * min(df) from t1;
|
||||
1e8 * min(df)
|
||||
110000000
|
||||
110000000.00000001
|
||||
create table t3 (ifl int);
|
||||
insert into t3 values(1), (2);
|
||||
select cast(min(ifl) as decimal(5,2)) from t3;
|
||||
@@ -1186,7 +1186,7 @@ std(s1/s2)
|
||||
0.21325764
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select std(e1/e2) from bug22555;
|
||||
std(e1/e2)
|
||||
0.21325764
|
||||
@@ -1209,13 +1209,13 @@ i count(*) std(e1/e2)
|
||||
3 4 0.000000000000000000000000000000
|
||||
select round(std(s1/s2), 17) from bug22555;
|
||||
round(std(s1/s2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select round(std(e1/e2), 17) from bug22555;
|
||||
round(std(e1/e2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
set div_precision_increment=20;
|
||||
select i, count(*), std(s1/s2) from bug22555 group by i order by i;
|
||||
i count(*) std(s1/s2)
|
||||
@@ -1234,13 +1234,13 @@ i count(*) std(e1/e2)
|
||||
3 4 0.000000000000000000000000000000
|
||||
select round(std(s1/s2), 17) from bug22555;
|
||||
round(std(s1/s2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
select std(o1/o2) from bug22555;
|
||||
std(o1/o2)
|
||||
0.213257635866493
|
||||
0.2132576358664934
|
||||
select round(std(e1/e2), 17) from bug22555;
|
||||
round(std(e1/e2), 17)
|
||||
0.21325763586649341
|
||||
0.21325763586649340
|
||||
set @@div_precision_increment=@saved_div_precision_increment;
|
||||
drop table bug22555;
|
||||
create table bug22555 (s smallint, o double, e decimal);
|
||||
|
||||
Reference in New Issue
Block a user