diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-03-13 18:13:38 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-03-13 18:13:45 -0400 |
commit | c6f153dcfebccf7a0d92290037793c656f1caef5 (patch) | |
tree | 949c91b33c419ce9417c4c076b45608148997d3a /src | |
parent | c6c9474aafa4de357ae424cd18b69e8bf7a4babe (diff) | |
download | postgresql-c6f153dcfebccf7a0d92290037793c656f1caef5.tar.gz postgresql-c6f153dcfebccf7a0d92290037793c656f1caef5.zip |
Rethink how to test the hyperbolic functions.
The initial commit tried to test them on trivial cases such as 0,
reasoning that we shouldn't hit any portability issues that way.
The buildfarm immediately proved that hope ill-founded, and anyway
it's not a great testing scheme because it doesn't prove that we're
even calling the right library function for each SQL function.
Instead, let's test them at inputs such as 1 (or something within
the valid range, as needed), so that each function should produce
a different output.
As committed, this is just about certain to show portability
failures, because it's very unlikely that every platform computes
these functions the same as mine down to the last bit. However,
I want to put it through a buildfarm cycle this way, so that
we can see how big the variations are. The plan is to add
"set extra_float_digits = -1", or whatever we need in order to
hide the variations; but first we need data.
Discussion: https://postgr.es/m/E1h3nUY-0000sM-Vf@gemulon.postgresql.org
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/float8.out | 50 | ||||
-rw-r--r-- | src/test/regress/sql/float8.sql | 16 |
2 files changed, 33 insertions, 33 deletions
diff --git a/src/test/regress/expected/float8.out b/src/test/regress/expected/float8.out index 36b2acda739..7aed4aa97f8 100644 --- a/src/test/regress/expected/float8.out +++ b/src/test/regress/expected/float8.out @@ -454,44 +454,44 @@ SELECT '' AS five, * FROM FLOAT8_TBL; | -1.2345678901234e-200 (5 rows) +RESET extra_float_digits; -- hyperbolic functions -SELECT sinh(float8 '0'); - sinh ------- - 0 +SELECT sinh(float8 '1'); + sinh +-------------------- + 1.1752011936438014 (1 row) -SELECT cosh(float8 '0'); - cosh ------- - 1 +SELECT cosh(float8 '1'); + cosh +-------------------- + 1.5430806348152437 (1 row) -SELECT tanh(float8 '0'); - tanh ------- - 0 +SELECT tanh(float8 '1'); + tanh +-------------------- + 0.7615941559557649 (1 row) -SELECT asinh(float8 '0'); - asinh -------- - 0 +SELECT asinh(float8 '1'); + asinh +------------------- + 0.881373587019543 (1 row) -SELECT acosh(float8 '1'); - acosh -------- - 0 +SELECT acosh(float8 '2'); + acosh +-------------------- + 1.3169578969248166 (1 row) -SELECT atanh(float8 '0'); - atanh -------- - 0 +SELECT atanh(float8 '0.5'); + atanh +-------------------- + 0.5493061443340548 (1 row) -RESET extra_float_digits; -- test for over- and underflow INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); ERROR: "10e400" is out of range for type double precision diff --git a/src/test/regress/sql/float8.sql b/src/test/regress/sql/float8.sql index 4660cd265eb..07fbb66c947 100644 --- a/src/test/regress/sql/float8.sql +++ b/src/test/regress/sql/float8.sql @@ -154,16 +154,16 @@ SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f; SELECT '' AS five, * FROM FLOAT8_TBL; --- hyperbolic functions -SELECT sinh(float8 '0'); -SELECT cosh(float8 '0'); -SELECT tanh(float8 '0'); -SELECT asinh(float8 '0'); -SELECT acosh(float8 '1'); -SELECT atanh(float8 '0'); - RESET extra_float_digits; +-- hyperbolic functions +SELECT sinh(float8 '1'); +SELECT cosh(float8 '1'); +SELECT tanh(float8 '1'); +SELECT asinh(float8 '1'); +SELECT acosh(float8 '2'); +SELECT atanh(float8 '0.5'); + -- test for over- and underflow INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400'); |