From 5fe21c3e2b88e8248c79311401db03124e88bc52 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Tue, 17 Sep 2019 10:29:53 -0400 Subject: 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. --- src/proj_math.h | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/proj_math.h') diff --git a/src/proj_math.h b/src/proj_math.h index 5aea494d..414df805 100644 --- a/src/proj_math.h +++ b/src/proj_math.h @@ -64,16 +64,25 @@ extern "C" { double pj_hypot(double x, double y); double pj_log1p(double x); double pj_asinh(double x); +double pj_atanh(double x); +double pj_copysign(double x, double y); +double pj_cbrt(double x); +double pj_remainder(double x, double y); +double pj_remquo(double x, double y, int* n); double pj_round(double x); long pj_lround(double x); int PROJ_DLL pj_isnan(double x); -#define hypot pj_hypot -#define log1p pj_log1p -#define asinh pj_asinh -#define round pj_round -#define lround pj_lround - +#define hypot pj_hypot +#define log1p pj_log1p +#define asinh pj_asinh +#define atanh pj_atanh +#define copysign pj_copysign +#define cbrt pj_cbrt +#define remainder pj_remainder +#define remquo pj_remquo +#define round pj_round +#define lround pj_lround #ifdef isnan #undef isnan -- cgit v1.2.3 From 93d0f53db70b581718f29601df11f4b819ef943e Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Wed, 18 Sep 2019 07:08:55 -0400 Subject: Try removing C99 math functions from math.cpp (but leave isnan). --- src/proj_math.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'src/proj_math.h') diff --git a/src/proj_math.h b/src/proj_math.h index 414df805..698654dd 100644 --- a/src/proj_math.h +++ b/src/proj_math.h @@ -61,29 +61,8 @@ extern "C" { #endif #endif -double pj_hypot(double x, double y); -double pj_log1p(double x); -double pj_asinh(double x); -double pj_atanh(double x); -double pj_copysign(double x, double y); -double pj_cbrt(double x); -double pj_remainder(double x, double y); -double pj_remquo(double x, double y, int* n); -double pj_round(double x); -long pj_lround(double x); int PROJ_DLL pj_isnan(double x); -#define hypot pj_hypot -#define log1p pj_log1p -#define asinh pj_asinh -#define atanh pj_atanh -#define copysign pj_copysign -#define cbrt pj_cbrt -#define remainder pj_remainder -#define remquo pj_remquo -#define round pj_round -#define lround pj_lround - #ifdef isnan #undef isnan #endif -- cgit v1.2.3 From 646da7bf3868090ec8ac2d05ab63781de86be64b Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Wed, 18 Sep 2019 14:25:15 -0400 Subject: math.cpp removed since its isnan isn't used. Keep proj_math.h (which just includes math.h and limits.h) since it's included in a score of places. --- src/proj_math.h | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) (limited to 'src/proj_math.h') diff --git a/src/proj_math.h b/src/proj_math.h index 698654dd..ac7fc51d 100644 --- a/src/proj_math.h +++ b/src/proj_math.h @@ -1,6 +1,6 @@ /****************************************************************************** * Project: PROJ - * Purpose: Make C99 math functions available on C89 systems + * Purpose: Math support for PROJ -- now provided by system libraries * Author: Kristian Evers * ****************************************************************************** @@ -31,48 +31,4 @@ #include #include -#ifdef __cplusplus -extern "C" { -#endif - -#if !(defined(HAVE_C99_MATH) && HAVE_C99_MATH) - -#ifndef PROJ_DLL -#ifdef PROJ_MSVC_DLL_EXPORT -#define PROJ_DLL __declspec(dllexport) -#elif defined(PROJ_MSVC_DLL_IMPORT) -#define PROJ_DLL __declspec(dllimport) -#elif defined(__GNUC__) -#define PROJ_DLL __attribute__ ((visibility("default"))) -#else -#define PROJ_DLL -#endif -#endif - -#ifdef PROJ_RENAME_SYMBOLS -#include "proj_symbol_rename.h" -#endif - -#ifndef NAN -#ifdef _WIN32 -#define NAN sqrt(-1.0) -#else -#define NAN 0.0/0.0 -#endif -#endif - -int PROJ_DLL pj_isnan(double x); - -#ifdef isnan -#undef isnan -#endif - -#define isnan pj_isnan - -#endif /* !(defined(HAVE_C99_MATH) && HAVE_C99_MATH) */ - -#ifdef __cplusplus -} -#endif - #endif /* PROJ_MATH_H */ -- cgit v1.2.3 From aa215ceeaaf6e5120f0eb2d28887471a8d819f10 Mon Sep 17 00:00:00 2001 From: Charles Karney Date: Wed, 18 Sep 2019 16:29:35 -0400 Subject: Delete proj_math.h. Replace includes by ; we'll see if anyone needs . Update scripts/reference_exported_symbols.txt and src/proj_symbol_rename.h. --- src/proj_math.h | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 src/proj_math.h (limited to 'src/proj_math.h') diff --git a/src/proj_math.h b/src/proj_math.h deleted file mode 100644 index ac7fc51d..00000000 --- a/src/proj_math.h +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************** - * Project: PROJ - * Purpose: Math support for PROJ -- now provided by system libraries - * Author: Kristian Evers - * - ****************************************************************************** - * Copyright (c) 2018, Kristian Evers - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - *****************************************************************************/ - -#ifndef PROJ_MATH_H -#define PROJ_MATH_H - -#include -#include - -#endif /* PROJ_MATH_H */ -- cgit v1.2.3