]> granicus.if.org Git - postgresql/commitdiff
Adjust new test case for more portability.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 24 Nov 2018 04:49:25 +0000 (23:49 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 24 Nov 2018 04:49:25 +0000 (23:49 -0500)
Early returns from the buildfarm say that most critters are good with
commit cbdb8b4c0, but gaur gives unexpected results with the test case
involving a float8 that's one-ULP-less-than-2^63.  It appears that that
platform's version of rint() rounds that value up to 2^63 instead of
leaving it be.  This is possibly a bug, and it's also possible that no
other platform anybody is using anywhere behaves likewise.  Still, the
point of the test is not to insist that everybody's rint() behaves exactly
the same.  Let's use two-ULPs-less-than-2^63 instead, which I've tested
to act the same on gaur as on more modern hardware.

(This is, more or less, exactly the portability issue I'd feared might
arise...)

Discussion: https://postgr.es/m/15519-4fc785b483201ff1@postgresql.org

src/test/regress/expected/float8-small-is-zero.out
src/test/regress/expected/float8.out
src/test/regress/sql/float8.sql

index ce173f72c982b60a89a7674a47cc43aa74b94a2c..1c3bbae6b8bb484a0b6ddcbcc9b59a61423f34f6 100644 (file)
@@ -511,10 +511,10 @@ SELECT '-2147483648.4'::float8::int4;
 
 SELECT '-2147483648.6'::float8::int4;
 ERROR:  integer out of range
-SELECT '9223372036854774784'::float8::int8;
+SELECT '9223372036854773760'::float8::int8;
         int8         
 ---------------------
- 9223372036854774784
+ 9223372036854773760
 (1 row)
 
 SELECT '9223372036854775807'::float8::int8;
index 1d51012a697136aae16008b943fa4c08b3f8335b..75c0bf389b92f6627ff2d032f414b8063b305afd 100644 (file)
@@ -513,10 +513,10 @@ SELECT '-2147483648.4'::float8::int4;
 
 SELECT '-2147483648.6'::float8::int4;
 ERROR:  integer out of range
-SELECT '9223372036854774784'::float8::int8;
+SELECT '9223372036854773760'::float8::int8;
         int8         
 ---------------------
- 9223372036854774784
+ 9223372036854773760
 (1 row)
 
 SELECT '9223372036854775807'::float8::int8;
index ed8794244667ccfd40251202946c96d0e9d0cad5..6595fd2b958b979443b6452d9b2ca7065656537b 100644 (file)
@@ -183,7 +183,7 @@ SELECT '2147483647.4'::float8::int4;
 SELECT '2147483647.6'::float8::int4;
 SELECT '-2147483648.4'::float8::int4;
 SELECT '-2147483648.6'::float8::int4;
-SELECT '9223372036854774784'::float8::int8;
+SELECT '9223372036854773760'::float8::int8;
 SELECT '9223372036854775807'::float8::int8;
 SELECT '-9223372036854775808.5'::float8::int8;
 SELECT '-9223372036854780000'::float8::int8;