aboutsummaryrefslogtreecommitdiff
path: root/src/geodesic.c
diff options
context:
space:
mode:
authorCharles Karney <charles.karney@sri.com>2019-09-17 10:29:53 -0400
committerCharles Karney <charles.karney@sri.com>2019-09-17 10:29:53 -0400
commit5fe21c3e2b88e8248c79311401db03124e88bc52 (patch)
treedbf302a888dd4aa286af6f4d5a504752632e1da5 /src/geodesic.c
parentd2f661fc99615a33d72bb0120a14bca2aaced221 (diff)
downloadPROJ-5fe21c3e2b88e8248c79311401db03124e88bc52.tar.gz
PROJ-5fe21c3e2b88e8248c79311401db03124e88bc52.zip
Add atanh, copysign, cbrt, remainder, remquo to math.cpp.
The supported C99 math functions provided by math.cpp are thus hypot log1p asinh atanh copysign cbrt remainder remquo round lround Make compiler checks in CMakeLists.txt and configure.ac consistent with this set. Make geodesic.c use the math.cpp defined (instead of the internally defined) versions of hypot atanh copysign cbrt This is keyed off the presence of the PROJ_LIB macro. I had at one time https://github.com/OSGeo/PROJ/pull/1425 suggested supplying an additional macro PROJ_COMPILATION when compiling geodesic.c. However, PROJ_LIB seems to fill the bill OK. The *next* version of geodesic.c (due out in a few weeks) will also use remainder remquo All of this is only of concern for C compilers without C99 support. So this may become an historical footnote at some point.
Diffstat (limited to 'src/geodesic.c')
-rw-r--r--src/geodesic.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/geodesic.c b/src/geodesic.c
index 5504cb3b..887edb42 100644
--- a/src/geodesic.c
+++ b/src/geodesic.c
@@ -23,8 +23,19 @@
* https://geographiclib.sourceforge.io/
*/
+/* The PROJ_COMPILATION flag indicates that this is part of the compilation of
+ * the PROJ library (keyed off the presence of the PROJ_LIB macro which points
+ * to the data directory for PROJ). If this is set, we use the PROJ supplied
+ * implementations of the C99 math functions instead of the ones defined here.
+ */
+#if defined(PROJ_LIB)
+#define PROJ_COMPILATION 1
+#else
+#define PROJ_COMPILATION 0
+#endif
+
#include "geodesic.h"
-#ifdef PJ_LIB__
+#if PROJ_COMPILAION
#include "proj_math.h"
#else
#include <math.h>
@@ -122,7 +133,7 @@ enum captype {
};
static real sq(real x) { return x * x; }
-#if HAVE_C99_MATH
+#if HAVE_C99_MATH || PROJ_COMPILATION
#define atanhx atanh
#define copysignx copysign
#define hypotx hypot