Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda6520b

Browse files
committed
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 tocopy_special_str, to see if this fixes the mac/ppc failures (perbuildfarm members prariedog and locust). (Isolated test programs on appc mac don't seem to show any other cause that would explain them.)
1 parent711bab1 commitda6520b

File tree

4 files changed

+39
-34
lines changed

4 files changed

+39
-34
lines changed

‎src/common/d2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ double_to_shortest_decimal_bufn(double f, char *result)
10281028
/* Case distinction; exit early for the easy cases. */
10291029
if (ieeeExponent== ((1u <<DOUBLE_EXPONENT_BITS)-1u)|| (ieeeExponent==0&&ieeeMantissa==0))
10301030
{
1031-
returncopy_special_str(result,ieeeSign,ieeeExponent,ieeeMantissa);
1031+
returncopy_special_str(result,ieeeSign,(ieeeExponent!=0), (ieeeMantissa!=0));
10321032
}
10331033

10341034
floating_decimal_64v;

‎src/common/f2s.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ float_to_shortest_decimal_bufn(float f, char *result)
756756
/* Case distinction; exit early for the easy cases. */
757757
if (ieeeExponent== ((1u <<FLOAT_EXPONENT_BITS)-1u)|| (ieeeExponent==0&&ieeeMantissa==0))
758758
{
759-
returncopy_special_str(result,ieeeSign,ieeeExponent,ieeeMantissa);
759+
returncopy_special_str(result,ieeeSign,(ieeeExponent!=0), (ieeeMantissa!=0));
760760
}
761761

762762
floating_decimal_32v;

‎src/test/regress/expected/tstypes.out

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-- deal with numeric instability of ts_rank
2+
SET extra_float_digits = 0;
13
--Base tsvector test
24
SELECT '1'::tsvector;
35
tsvector
@@ -787,57 +789,57 @@ select to_tsvector('simple', '') @@ '!foo' AS "true";
787789

788790
--ranking
789791
SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a | s');
790-
ts_rank
791-
-------------
792-
0.091189064
792+
ts_rank
793+
-----------
794+
0.0911891
793795
(1 row)
794796

795797
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s');
796-
ts_rank
797-
-------------
798-
0.030396355
798+
ts_rank
799+
-----------
800+
0.0303964
799801
(1 row)
800802

801803
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | s:*');
802-
ts_rank
803-
-------------
804-
0.091189064
804+
ts_rank
805+
-----------
806+
0.0911891
805807
(1 row)
806808

807809
SELECT ts_rank(' a:1 sa:2C d g'::tsvector, 'a | sa:*');
808-
ts_rank
809-
-------------
810-
0.091189064
810+
ts_rank
811+
-----------
812+
0.0911891
811813
(1 row)
812814

813815
SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a | s');
814-
ts_rank
815-
------------
816-
0.15198177
816+
ts_rank
817+
----------
818+
0.151982
817819
(1 row)
818820

819821
SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a | s');
820-
ts_rank
821-
------------
822-
0.06079271
822+
ts_rank
823+
-----------
824+
0.0607927
823825
(1 row)
824826

825827
SELECT ts_rank(' a:1 s:2C d g'::tsvector, 'a & s');
826-
ts_rank
827-
------------
828-
0.14015312
828+
ts_rank
829+
----------
830+
0.140153
829831
(1 row)
830832

831833
SELECT ts_rank(' a:1 s:2B d g'::tsvector, 'a & s');
832-
ts_rank
833-
------------
834-
0.19820644
834+
ts_rank
835+
----------
836+
0.198206
835837
(1 row)
836838

837839
SELECT ts_rank(' a:1 s:2 d g'::tsvector, 'a & s');
838-
ts_rank
839-
------------
840-
0.09910322
840+
ts_rank
841+
-----------
842+
0.0991032
841843
(1 row)
842844

843845
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');
885887
SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a & s');
886888
ts_rank_cd
887889
------------
888-
0.13333334
890+
0.133333
889891
(1 row)
890892

891893
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');
903905
SELECT ts_rank_cd(' a:1 s:2A d g'::tsvector, 'a <-> s');
904906
ts_rank_cd
905907
------------
906-
0.18181819
908+
0.181818
907909
(1 row)
908910

909911
SELECT ts_rank_cd(' a:1 s:2C d g'::tsvector, 'a <-> s');
910912
ts_rank_cd
911913
------------
912-
0.13333334
914+
0.133333
913915
(1 row)
914916

915917
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');
927929
SELECT ts_rank_cd(' a:1 s:2,3A d:2A g'::tsvector, 'a <2> s:A');
928930
ts_rank_cd
929931
------------
930-
0.09090909
932+
0.0909091
931933
(1 row)
932934

933935
SELECT ts_rank_cd(' a:1 b:2 s:3A d:2A g'::tsvector, 'a <2> s:A');
934936
ts_rank_cd
935937
------------
936-
0.09090909
938+
0.0909091
937939
(1 row)
938940

939941
SELECT ts_rank_cd(' a:1 sa:2D sb:2A g'::tsvector, 'a <-> s:*');

‎src/test/regress/sql/tstypes.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
-- deal with numeric instability of ts_rank
2+
SET extra_float_digits=0;
3+
14
--Base tsvector test
25

36
SELECT'1'::tsvector;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp