diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-03 21:21:03 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-08-03 21:21:03 +0000 |
commit | db04f2b3225aa7e6d496a087c4c0e46161744573 (patch) | |
tree | 3b266b93ef231ee79180afba740b3c472ad28d8a /src/include/utils/geo_decls.h | |
parent | 90a391c645774c2606ae4b82f4a07130afdd0a42 (diff) | |
download | postgresql-db04f2b3225aa7e6d496a087c4c0e46161744573.tar.gz |
Replace the naive HYPOT() macro with a standards-conformant hypotenuse
function. This avoids unnecessary overflows and probably gives a more
accurate result as well.
Paul Matthews, reviewed by Andrew Geery
Diffstat (limited to 'src/include/utils/geo_decls.h')
-rw-r--r-- | src/include/utils/geo_decls.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h index f43d2d5fdc..904d9f7948 100644 --- a/src/include/utils/geo_decls.h +++ b/src/include/utils/geo_decls.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/utils/geo_decls.h,v 1.57 2010/01/14 16:31:09 teodor Exp $ + * $PostgreSQL: pgsql/src/include/utils/geo_decls.h,v 1.58 2010/08/03 21:21:03 tgl Exp $ * * NOTE * These routines do *not* use the float types from adt/. @@ -50,7 +50,7 @@ #define FPge(A,B) ((A) >= (B)) #endif -#define HYPOT(A, B) sqrt((A) * (A) + (B) * (B)) +#define HYPOT(A, B) pg_hypot(A, B) /*--------------------------------------------------------------------- * Point - (x,y) @@ -211,6 +211,7 @@ extern Datum point_div(PG_FUNCTION_ARGS); /* private routines */ extern double point_dt(Point *pt1, Point *pt2); extern double point_sl(Point *pt1, Point *pt2); +extern double pg_hypot(double x, double y); /* public lseg routines */ extern Datum lseg_in(PG_FUNCTION_ARGS); |