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

Fix overlaps.sql test fail on 32 bit Debian due to gcc bug 323#62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vitcpp merged 2 commits intopostgrespro:masterfromvitcpp:gcc-bug-323
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletionsMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
PGSPHERE_VERSION = 1.3.0
PGSPHERE_VERSION = 1.3.1
EXTENSION = pg_sphere
RELEASE_SQL = $(EXTENSION)--$(PGSPHERE_VERSION).sql
USE_PGXS = 1
Expand DownExpand Up@@ -28,7 +28,8 @@ DATA_built = $(RELEASE_SQL) \
pg_sphere--1.2.0--1.2.1.sql \
pg_sphere--1.2.1--1.2.2.sql \
pg_sphere--1.2.2--1.2.3.sql \
pg_sphere--1.2.3--1.3.0.sql
pg_sphere--1.2.3--1.3.0.sql \
pg_sphere--1.3.0--1.3.1.sql

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

pg_sphere--1.3.0--1.3.1.sql:
cat upgrade_scripts/$@.in > $@

# end of local stuff

src/sscan.o : src/sparse.c
Expand Down
2 changes: 1 addition & 1 deletionexpected/init.out
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,6 +6,6 @@ CREATE EXTENSION pg_sphere;
select pg_sphere_version();
pg_sphere_version
-------------------
1.3.0
1.3.1
(1 row)

File renamed without changes.
2 changes: 1 addition & 1 deletionpg_sphere.control
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
# pg_sphere extension
comment = 'spherical objects with useful functions, operators and index support'
default_version = '1.3.0'
default_version = '1.3.1'
module_pathname = '$libdir/pg_sphere'
relocatable = true
77 changes: 77 additions & 0 deletionssrc/pg_sphere.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,10 +45,85 @@

#include "pgs_util.h"

/* On some 32 bit platforms, there is a gcc bug that makes floating point
* calculations and comparisons unstable (see the link below). The problem
* originates in FPU 80 bits registers where double values are not truncated
* to 64 bit values. When gcc compiles some code with enabled optimizations,
* the intermediate results may be kept in the FPU registers without truncation
* to 64 bit values. Extra bits may produce unstable results when comparing
* the numbers.
*
* The generic solution is to save the intermediate results in the memory where
* the values are truncated to 64 bit values. It affects the performance but
* makes the tests stable on all platforms.
*
* PGSPHERE_FLOAT_STORE macro enables storing of intermediate results for FPxx
* operations in the memory. It is enabled by default for 32 bit platforms.
* It can be explicitly enabled or disabled in CFLAGS. To enable it for all
* code the gcc option -ffloat-store may be used as well.
*
* Link to gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323
*/
#if !defined(PGSPHERE_FLOAT_STORE)
#if _WIN64 || (__GNUC__ && __x86_64__)
#define PGSPHERE_FLOAT_STORE 0
#elif _WIN32 || __GNUC__
#define PGSPHERE_FLOAT_STORE 1
#else
#define PGSPHERE_FLOAT_STORE 0
#endif
#endif // PGSPHERE_FLOAT_STORE

#define EPSILON1.0E-09

#define FPzero(A)(fabs(A) <= EPSILON)

#if PGSPHERE_FLOAT_STORE

static inline bool
FPeq(double A, double B)
{
const volatile double AB = A - B;
return A == B || fabs(AB) <= EPSILON;
}

static inline bool
FPne(double A, double B)
{
const volatile double AB = A - B;
return A != B && fabs(AB) > EPSILON;
}

static inline bool
FPlt(double A, double B)
{
const volatile double AE = A + EPSILON;
return AE < B;
}

static inline bool
FPle(double A, double B)
{
const volatile double BE = B + EPSILON;
return A <= BE;
}

static inline bool
FPgt(double A, double B)
{
const volatile double BE = B + EPSILON;
return A > BE;
}

static inline bool
FPge(double A, double B)
{
const volatile double AE = A + EPSILON;
return AE >= B;
}

#else

static inline bool
FPeq(double A, double B)
{
Expand DownExpand Up@@ -85,6 +160,8 @@ FPge(double A, double B)
return A + EPSILON >= B;
}

#endif // PGSPHERE_FLOAT_STORE

/*---------------------------------------------------------------------
* Point - (x,y)
*-------------------------------------------------------------------*/
Expand Down
1 change: 1 addition & 0 deletionsupgrade_scripts/pg_sphere--1.3.0--1.3.1.sql.in
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
-- Nothing to upgrade in the schema

[8]ページ先頭

©2009-2025 Movatter.jp