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

Commitfb93eb4

Browse files
authored
Merge pull request#62 from vitcpp/gcc-bug-323
Fix overlaps.sql test fail on 32 bit Debian due to gcc bug 323
2 parents2385d5d +8e7c92f commitfb93eb4

File tree

6 files changed

+86
-4
lines changed

6 files changed

+86
-4
lines changed

‎Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PGSPHERE_VERSION = 1.3.0
1+
PGSPHERE_VERSION = 1.3.1
22
EXTENSION = pg_sphere
33
RELEASE_SQL =$(EXTENSION)--$(PGSPHERE_VERSION).sql
44
USE_PGXS = 1
@@ -28,7 +28,8 @@ DATA_built = $(RELEASE_SQL) \
2828
pg_sphere--1.2.0--1.2.1.sql\
2929
pg_sphere--1.2.1--1.2.2.sql\
3030
pg_sphere--1.2.2--1.2.3.sql\
31-
pg_sphere--1.2.3--1.3.0.sql
31+
pg_sphere--1.2.3--1.3.0.sql\
32+
pg_sphere--1.3.0--1.3.1.sql
3233

3334
DOCS = README.pg_sphere COPYRIGHT.pg_sphere
3435
REGRESS = init tables points euler circle line ellipse poly path box index\
@@ -265,6 +266,9 @@ pg_sphere--1.2.2--1.2.3.sql:
265266
pg_sphere--1.2.3--1.3.0.sql: pgs_brin.sql.in
266267
cat upgrade_scripts/$@.in$^>$@
267268

269+
pg_sphere--1.3.0--1.3.1.sql:
270+
cat upgrade_scripts/$@.in>$@
271+
268272
# end of local stuff
269273

270274
src/sscan.o : src/sparse.c

‎expected/init.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere;
66
select pg_sphere_version();
77
pg_sphere_version
88
-------------------
9-
1.3.0
9+
1.3.1
1010
(1 row)
1111

File renamed without changes.

‎pg_sphere.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pg_sphere extension
22
comment = 'spherical objects with useful functions, operators and index support'
3-
default_version = '1.3.0'
3+
default_version = '1.3.1'
44
module_pathname = '$libdir/pg_sphere'
55
relocatable = true

‎src/pg_sphere.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,85 @@
4545

4646
#include"pgs_util.h"
4747

48+
/* On some 32 bit platforms, there is a gcc bug that makes floating point
49+
* calculations and comparisons unstable (see the link below). The problem
50+
* originates in FPU 80 bits registers where double values are not truncated
51+
* to 64 bit values. When gcc compiles some code with enabled optimizations,
52+
* the intermediate results may be kept in the FPU registers without truncation
53+
* to 64 bit values. Extra bits may produce unstable results when comparing
54+
* the numbers.
55+
*
56+
* The generic solution is to save the intermediate results in the memory where
57+
* the values are truncated to 64 bit values. It affects the performance but
58+
* makes the tests stable on all platforms.
59+
*
60+
* PGSPHERE_FLOAT_STORE macro enables storing of intermediate results for FPxx
61+
* operations in the memory. It is enabled by default for 32 bit platforms.
62+
* It can be explicitly enabled or disabled in CFLAGS. To enable it for all
63+
* code the gcc option -ffloat-store may be used as well.
64+
*
65+
* Link to gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
66+
*/
67+
#if !defined(PGSPHERE_FLOAT_STORE)
68+
#if_WIN64|| (__GNUC__&&__x86_64__)
69+
#definePGSPHERE_FLOAT_STORE 0
70+
#elif_WIN32||__GNUC__
71+
#definePGSPHERE_FLOAT_STORE 1
72+
#else
73+
#definePGSPHERE_FLOAT_STORE 0
74+
#endif
75+
#endif// PGSPHERE_FLOAT_STORE
76+
4877
#defineEPSILON1.0E-09
4978

5079
#defineFPzero(A)(fabs(A) <= EPSILON)
5180

81+
#ifPGSPHERE_FLOAT_STORE
82+
83+
staticinlinebool
84+
FPeq(doubleA,doubleB)
85+
{
86+
constvolatiledoubleAB=A-B;
87+
returnA==B||fabs(AB) <=EPSILON;
88+
}
89+
90+
staticinlinebool
91+
FPne(doubleA,doubleB)
92+
{
93+
constvolatiledoubleAB=A-B;
94+
returnA!=B&&fabs(AB)>EPSILON;
95+
}
96+
97+
staticinlinebool
98+
FPlt(doubleA,doubleB)
99+
{
100+
constvolatiledoubleAE=A+EPSILON;
101+
returnAE<B;
102+
}
103+
104+
staticinlinebool
105+
FPle(doubleA,doubleB)
106+
{
107+
constvolatiledoubleBE=B+EPSILON;
108+
returnA <=BE;
109+
}
110+
111+
staticinlinebool
112+
FPgt(doubleA,doubleB)
113+
{
114+
constvolatiledoubleBE=B+EPSILON;
115+
returnA>BE;
116+
}
117+
118+
staticinlinebool
119+
FPge(doubleA,doubleB)
120+
{
121+
constvolatiledoubleAE=A+EPSILON;
122+
returnAE >=B;
123+
}
124+
125+
#else
126+
52127
staticinlinebool
53128
FPeq(doubleA,doubleB)
54129
{
@@ -85,6 +160,8 @@ FPge(double A, double B)
85160
returnA+EPSILON >=B;
86161
}
87162

163+
#endif// PGSPHERE_FLOAT_STORE
164+
88165
/*---------------------------------------------------------------------
89166
* Point - (x,y)
90167
*-------------------------------------------------------------------*/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- Nothing to upgrade in the schema

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp