mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-18 18:44:06 +08:00
Tweak the width_bucket() regression tests to avoid an unnecessary
dependency on the platform's floating point implementation. Per report from Stefan Kaltenbrunner.
This commit is contained in:
parent
3026e1765f
commit
530b10c719
@ -754,7 +754,7 @@ CREATE TABLE width_bucket_test (operand_num numeric, operand_f8 float8);
|
||||
COPY width_bucket_test (operand_num) FROM stdin;
|
||||
UPDATE width_bucket_test SET operand_f8 = operand_num::float8;
|
||||
SELECT
|
||||
operand_num, operand_f8,
|
||||
operand_num,
|
||||
width_bucket(operand_num, 0, 10, 5) AS wb_1,
|
||||
width_bucket(operand_f8, 0, 10, 5) AS wb_1f,
|
||||
width_bucket(operand_num, 10, 0, 5) AS wb_2,
|
||||
@ -766,27 +766,27 @@ SELECT
|
||||
width_bucket(operand_num, -25, 25, 10) AS wb_5,
|
||||
width_bucket(operand_f8, -25, 25, 10) AS wb_5f
|
||||
FROM width_bucket_test;
|
||||
operand_num | operand_f8 | wb_1 | wb_1f | wb_2 | wb_2f | wb_3 | wb_3f | wb_4 | wb_4f | wb_5 | wb_5f
|
||||
------------------+------------------+------+-------+------+-------+------+-------+------+-------+------+-------
|
||||
-5.2 | -5.2 | 0 | 0 | 6 | 6 | 0 | 0 | 0 | 0 | 4 | 4
|
||||
-0.0000000001 | -1e-10 | 0 | 0 | 6 | 6 | 0 | 0 | 0 | 0 | 5 | 5
|
||||
0.000000000001 | 1e-12 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
1 | 1 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
1.99999999999999 | 1.99999999999999 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
2 | 2 | 2 | 2 | 5 | 5 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
2.00000000000001 | 2.00000000000001 | 2 | 2 | 4 | 4 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
3 | 3 | 2 | 2 | 4 | 4 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
4 | 4 | 3 | 3 | 4 | 4 | 2 | 2 | 0 | 0 | 6 | 6
|
||||
4.5 | 4.5 | 3 | 3 | 3 | 3 | 2 | 2 | 0 | 0 | 6 | 6
|
||||
5 | 5 | 3 | 3 | 3 | 3 | 3 | 3 | 1 | 1 | 7 | 7
|
||||
5.5 | 5.5 | 3 | 3 | 3 | 3 | 3 | 3 | 21 | 21 | 7 | 7
|
||||
6 | 6 | 4 | 4 | 3 | 3 | 3 | 3 | 21 | 21 | 7 | 7
|
||||
7 | 7 | 4 | 4 | 2 | 2 | 4 | 4 | 21 | 21 | 7 | 7
|
||||
8 | 8 | 5 | 5 | 2 | 2 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
9 | 9 | 5 | 5 | 1 | 1 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
9.99999999999999 | 9.99999999999999 | 5 | 5 | 1 | 1 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
10 | 10 | 6 | 6 | 1 | 1 | 5 | 5 | 21 | 21 | 8 | 8
|
||||
10.0000000000001 | 10.0000000000001 | 6 | 6 | 0 | 0 | 5 | 5 | 21 | 21 | 8 | 8
|
||||
operand_num | wb_1 | wb_1f | wb_2 | wb_2f | wb_3 | wb_3f | wb_4 | wb_4f | wb_5 | wb_5f
|
||||
------------------+------+-------+------+-------+------+-------+------+-------+------+-------
|
||||
-5.2 | 0 | 0 | 6 | 6 | 0 | 0 | 0 | 0 | 4 | 4
|
||||
-0.0000000001 | 0 | 0 | 6 | 6 | 0 | 0 | 0 | 0 | 5 | 5
|
||||
0.000000000001 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
1 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
1.99999999999999 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 6 | 6
|
||||
2 | 2 | 2 | 5 | 5 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
2.00000000000001 | 2 | 2 | 4 | 4 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
3 | 2 | 2 | 4 | 4 | 1 | 1 | 0 | 0 | 6 | 6
|
||||
4 | 3 | 3 | 4 | 4 | 2 | 2 | 0 | 0 | 6 | 6
|
||||
4.5 | 3 | 3 | 3 | 3 | 2 | 2 | 0 | 0 | 6 | 6
|
||||
5 | 3 | 3 | 3 | 3 | 3 | 3 | 1 | 1 | 7 | 7
|
||||
5.5 | 3 | 3 | 3 | 3 | 3 | 3 | 21 | 21 | 7 | 7
|
||||
6 | 4 | 4 | 3 | 3 | 3 | 3 | 21 | 21 | 7 | 7
|
||||
7 | 4 | 4 | 2 | 2 | 4 | 4 | 21 | 21 | 7 | 7
|
||||
8 | 5 | 5 | 2 | 2 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
9 | 5 | 5 | 1 | 1 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
9.99999999999999 | 5 | 5 | 1 | 1 | 5 | 5 | 21 | 21 | 7 | 7
|
||||
10 | 6 | 6 | 1 | 1 | 5 | 5 | 21 | 21 | 8 | 8
|
||||
10.0000000000001 | 6 | 6 | 0 | 0 | 5 | 5 | 21 | 21 | 8 | 8
|
||||
(19 rows)
|
||||
|
||||
-- for float8 only, check positive and negative infinity: we require
|
||||
|
@ -708,7 +708,7 @@ COPY width_bucket_test (operand_num) FROM stdin;
|
||||
UPDATE width_bucket_test SET operand_f8 = operand_num::float8;
|
||||
|
||||
SELECT
|
||||
operand_num, operand_f8,
|
||||
operand_num,
|
||||
width_bucket(operand_num, 0, 10, 5) AS wb_1,
|
||||
width_bucket(operand_f8, 0, 10, 5) AS wb_1f,
|
||||
width_bucket(operand_num, 10, 0, 5) AS wb_2,
|
||||
|
Loading…
Reference in New Issue
Block a user