Make a test not depend on the lack of floating point associativity

This commit is contained in:
Alexey Milovidov 2024-01-02 21:59:32 +01:00 committed by chenwei
parent eb930efebb
commit 03951e1b21
2 changed files with 26 additions and 26 deletions

View File

@ -1,14 +1,14 @@
2.4 2.4
10.165 10.165
0.00012000000000000002 0.00012
150.16500000000002 150.165
7.775900000000001 7.7759
56.622689999999984 56.62269
598.8376688440277 598.837669
299.41883695311844 299.418837
0.7485470860550345 0.748547
2.2456412771483882 2.245641
1.641386318314034 1.641386
1.641386318314034 1.641386
1.6413863258732018 1.641386
1.6413863258732018 1.641386

View File

@ -1,9 +1,9 @@
SET optimize_arithmetic_operations_in_aggregate_functions = 0; SET optimize_arithmetic_operations_in_aggregate_functions = 0;
SELECT toDecimal32(2, 2) * 1.2; SELECT round(toDecimal32(2, 2) * 1.2, 6);
SELECT toDecimal64(0.5, 2) * 20.33; SELECT round(toDecimal64(0.5, 2) * 20.33, 6);
SELECT 0.00001 * toDecimal32(12, 2); SELECT round(0.00001 * toDecimal32(12, 2), 6);
SELECT 30.033 * toDecimal32(5, 1); SELECT round(30.033 * toDecimal32(5, 1), 6);
CREATE TABLE IF NOT EXISTS test01603 ( CREATE TABLE IF NOT EXISTS test01603 (
f64 Float64, f64 Float64,
@ -13,17 +13,17 @@ CREATE TABLE IF NOT EXISTS test01603 (
INSERT INTO test01603(f64) SELECT 1 / (number + 1) FROM system.numbers LIMIT 1000; INSERT INTO test01603(f64) SELECT 1 / (number + 1) FROM system.numbers LIMIT 1000;
SELECT sum(d * 1.1) FROM test01603; SELECT round(sum(d * 1.1), 6) FROM test01603;
SELECT sum(8.01 * d) FROM test01603; SELECT round(sum(8.01 * d), 6) FROM test01603;
SELECT sum(f64 * toDecimal64(80, 2)) FROM test01603; SELECT round(sum(f64 * toDecimal64(80, 2)), 6) FROM test01603;
SELECT sum(toDecimal64(40, 2) * f32) FROM test01603; SELECT round(sum(toDecimal64(40, 2) * f32), 6) FROM test01603;
SELECT sum(f64 * toDecimal64(0.1, 2)) FROM test01603; SELECT round(sum(f64 * toDecimal64(0.1, 2)), 6) FROM test01603;
SELECT sum(toDecimal64(0.3, 2) * f32) FROM test01603; SELECT round(sum(toDecimal64(0.3, 2) * f32), 6) FROM test01603;
SELECT sum(f64 * d) FROM test01603; SELECT round(sum(f64 * d), 6) FROM test01603;
SELECT sum(d * f64) FROM test01603; SELECT round(sum(d * f64), 6) FROM test01603;
SELECT sum(f32 * d) FROM test01603; SELECT round(sum(f32 * d), 6) FROM test01603;
SELECT sum(d * f32) FROM test01603; SELECT round(sum(d * f32), 6) FROM test01603;
DROP TABLE IF EXISTS test01603; DROP TABLE IF EXISTS test01603;