Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 434ddfb

Browse files
committed
Improve numeric_power() tests for large integer powers.
Two of the tests added by 4dd5ce2 fail on buildfarm member castoroides, though it's not clear why. Improve the tests to report the actual values produced, if they're not what was expected. Apply to v11 only for now, until it's clearer what's going on.
1 parent 4851940 commit 434ddfb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/regress/expected/numeric.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,10 +1668,10 @@ select 1.000000000123 ^ (-2147483648);
16681668
0.7678656556403084
16691669
(1 row)
16701670

1671-
select 0.9999999999 ^ 23300000000000 = 0 as rounds_to_zero;
1671+
select coalesce(nullif(0.9999999999 ^ 23300000000000, 0), 0) as rounds_to_zero;
16721672
rounds_to_zero
16731673
----------------
1674-
t
1674+
0
16751675
(1 row)
16761676

16771677
-- cases that used to error out
@@ -1687,10 +1687,10 @@ select 0.5678 ^ (-85);
16871687
782333637740774446257.7719390061997396
16881688
(1 row)
16891689

1690-
select 0.9999999999 ^ 70000000000000 = 0 as underflows;
1690+
select coalesce(nullif(0.9999999999 ^ 70000000000000, 0), 0) as underflows;
16911691
underflows
16921692
------------
1693-
t
1693+
0
16941694
(1 row)
16951695

16961696
-- negative base to integer powers

src/test/regress/sql/numeric.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,12 +907,12 @@ select 3.789 ^ 35;
907907
select 1.2 ^ 345;
908908
select 0.12 ^ (-20);
909909
select 1.000000000123 ^ (-2147483648);
910-
select 0.9999999999 ^ 23300000000000 = 0 as rounds_to_zero;
910+
select coalesce(nullif(0.9999999999 ^ 23300000000000, 0), 0) as rounds_to_zero;
911911

912912
-- cases that used to error out
913913
select 0.12 ^ (-25);
914914
select 0.5678 ^ (-85);
915-
select 0.9999999999 ^ 70000000000000 = 0 as underflows;
915+
select coalesce(nullif(0.9999999999 ^ 70000000000000, 0), 0) as underflows;
916916

917917
-- negative base to integer powers
918918
select (-1.0) ^ 2147483646;

0 commit comments

Comments
 (0)