Commit da6520be authored by Andrew Gierth's avatar Andrew Gierth

More float test and portability fixes.

Avoid assuming exact results in tstypes test; some platforms vary.
(per buildfarm members eulachon, danio, lapwing)

Avoid dubious usage (inherited from upstream) of bool parameters to
copy_special_str, to see if this fixes the mac/ppc failures (per
buildfarm members prariedog and locust). (Isolated test programs on a
ppc mac don't seem to show any other cause that would explain them.)
parent 711bab1e
...@@ -1028,7 +1028,7 @@ double_to_shortest_decimal_bufn(double f, char *result) ...@@ -1028,7 +1028,7 @@ double_to_shortest_decimal_bufn(double f, char *result)
/* Case distinction; exit early for the easy cases. */ /* Case distinction; exit early for the easy cases. */
if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) if (ieeeExponent == ((1u << DOUBLE_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0))
{ {
return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa); return copy_special_str(result, ieeeSign, (ieeeExponent != 0), (ieeeMantissa != 0));
} }
floating_decimal_64 v; floating_decimal_64 v;
......
...@@ -756,7 +756,7 @@ float_to_shortest_decimal_bufn(float f, char *result) ...@@ -756,7 +756,7 @@ float_to_shortest_decimal_bufn(float f, char *result)
/* Case distinction; exit early for the easy cases. */ /* Case distinction; exit early for the easy cases. */
if (ieeeExponent == ((1u << FLOAT_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0)) if (ieeeExponent == ((1u << FLOAT_EXPONENT_BITS) - 1u) || (ieeeExponent == 0 && ieeeMantissa == 0))
{ {
return copy_special_str(result, ieeeSign, ieeeExponent, ieeeMantissa); return copy_special_str(result, ieeeSign, (ieeeExponent != 0), (ieeeMantissa != 0));
} }
floating_decimal_32 v; floating_decimal_32 v;
......
-- deal with numeric instability of ts_rank
SET extra_float_digits = 0;
--Base tsvector test --Base tsvector test
SELECT '1'::tsvector; SELECT '1'::tsvector;
tsvector tsvector
...@@ -787,57 +789,57 @@ select to_tsvector('simple', '') @@ '!foo' AS "true"; ...@@ -787,57 +789,57 @@ select to_tsvector('simple', '') @@ '!foo' AS "true";
--ranking --ranking
SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a | s'); SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a | s');
ts_rank ts_rank
------------- -----------
0.091189064 0.0911891
(1 row) (1 row)
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s'); SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s');
ts_rank ts_rank
------------- -----------
0.030396355 0.0303964
(1 row) (1 row)
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s:*'); SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s:*');
ts_rank ts_rank
------------- -----------
0.091189064 0.0911891
(1 row) (1 row)
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | sa:*'); SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | sa:*');
ts_rank ts_rank
------------- -----------
0.091189064 0.0911891
(1 row) (1 row)
SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a | s'); SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a | s');
ts_rank ts_rank
------------ ----------
0.15198177 0.151982
(1 row) (1 row)
SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a | s'); SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a | s');
ts_rank ts_rank
------------ -----------
0.06079271 0.0607927
(1 row) (1 row)
SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a & s'); SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a & s');
ts_rank ts_rank
------------ ----------
0.14015312 0.140153
(1 row) (1 row)
SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a & s'); SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a & s');
ts_rank ts_rank
------------ ----------
0.19820644 0.198206
(1 row) (1 row)
SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a & s'); SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a & s');
ts_rank ts_rank
------------ -----------
0.09910322 0.0991032
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a | s'); SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a | s');
...@@ -885,7 +887,7 @@ SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a | s'); ...@@ -885,7 +887,7 @@ SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a | s');
SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a & s'); SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a & s');
ts_rank_cd ts_rank_cd
------------ ------------
0.13333334 0.133333
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a & s'); SELECT ts_rank_cd(' a:1 s:2B d g'::tsvector, 'a & s');
...@@ -903,13 +905,13 @@ SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a & s'); ...@@ -903,13 +905,13 @@ SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a & s');
SELECT ts_rank_cd(' a:1 s:2A d g'::tsvector, 'a <-> s'); SELECT ts_rank_cd(' a:1 s:2A d g'::tsvector, 'a <-> s');
ts_rank_cd ts_rank_cd
------------ ------------
0.18181819 0.181818
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a <-> s'); SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a <-> s');
ts_rank_cd ts_rank_cd
------------ ------------
0.13333334 0.133333
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a <-> s'); SELECT ts_rank_cd(' a:1 s:2 d g'::tsvector, 'a <-> s');
...@@ -927,13 +929,13 @@ SELECT ts_rank_cd(' a:1 s:2 d:2A g'::tsvector, 'a <-> s'); ...@@ -927,13 +929,13 @@ SELECT ts_rank_cd(' a:1 s:2 d:2A g'::tsvector, 'a <-> s');
SELECT ts_rank_cd(' a:1 s:2,3A d:2A g'::tsvector, 'a <2> s:A'); SELECT ts_rank_cd(' a:1 s:2,3A d:2A g'::tsvector, 'a <2> s:A');
ts_rank_cd ts_rank_cd
------------ ------------
0.09090909 0.0909091
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 b:2 s:3A d:2A g'::tsvector, 'a <2> s:A'); SELECT ts_rank_cd(' a:1 b:2 s:3A d:2A g'::tsvector, 'a <2> s:A');
ts_rank_cd ts_rank_cd
------------ ------------
0.09090909 0.0909091
(1 row) (1 row)
SELECT ts_rank_cd(' a:1 sa:2D sb:2A g'::tsvector, 'a <-> s:*'); SELECT ts_rank_cd(' a:1 sa:2D sb:2A g'::tsvector, 'a <-> s:*');
......
-- deal with numeric instability of ts_rank
SET extra_float_digits = 0;
--Base tsvector test --Base tsvector test
SELECT '1'::tsvector; SELECT '1'::tsvector;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment