From cbd71f73748555870fe3511c2c95fea1d5cb171f Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Tue, 3 Jan 2012 23:52:42 +0000 Subject: [PATCH] Change to GNU macro NAN. Still not feeling The Confidence. git-svn-id: http://svn.osgeo.org/postgis/trunk@8667 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwgeodetic.c | 2 +- liblwgeom/lwgeodetic.h | 8 ++++++++ regress/tickets.sql | 1 + regress/tickets_expected | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c index db8172d9f..83d7db663 100644 --- a/liblwgeom/lwgeodetic.c +++ b/liblwgeom/lwgeodetic.c @@ -1870,7 +1870,7 @@ double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROI /* Same point, return NaN */ if ( FP_EQUALS(x1, x2) && FP_EQUALS(y1, y2) ) { - return nan(""); + return NAN; } /* Do the direction calculation */ diff --git a/liblwgeom/lwgeodetic.h b/liblwgeom/lwgeodetic.h index aac492d94..c68ee3936 100644 --- a/liblwgeom/lwgeodetic.h +++ b/liblwgeom/lwgeodetic.h @@ -11,6 +11,14 @@ #include "liblwgeom_internal.h" +/* For NAN */ +#define _GNU_SOURCE +#include + +#ifndef NAN +#define NAN 0.0/0.0 +#endif + extern int gbox_geocentric_slow; #define POW2(x) ((x)*(x)) diff --git a/regress/tickets.sql b/regress/tickets.sql index 9cbbb3abc..f39a5a842 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -478,6 +478,7 @@ SELECT '#657.3',ST_DWithin(ST_Project('POINT(10 10)'::geography, 2000, pi()/2), SELECT '#1305.1',ST_AsText(ST_Project('POINT(10 10)'::geography, 0, 0)); WITH pts AS ( SELECT 'POINT(0 45)'::geography AS s, 'POINT(45 45)'::geography AS e ) SELECT '#1305.2',abs(ST_Distance(e, ST_Project(s, ST_Distance(s, e), ST_Azimuth(s, e)))) < 0.001 FROM pts; +SELECT '#1305.3',ST_Azimuth('POINT(0 45)'::geography, 'POINT(0 45)'::geography) IS NULL; -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index 5938a0e34..de8ef7fd0 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -148,3 +148,4 @@ ERROR: Geometry type (Polygon) does not match column type (MultiPolygon) #657.3|t #1305.1|POINT(10 10) #1305.2|t +#1305.3|t -- 2.40.0