aboutsummaryrefslogtreecommitdiff
path: root/src/projects.h
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2016-06-01 21:49:36 +0200
committerKristian Evers <kristianevers@gmail.com>2016-06-01 21:49:36 +0200
commit7e2254310615a2830e1ecfd5d7538227b01d5657 (patch)
tree4263bc2ff9b8bec1a42e3903ef791db0c822653b /src/projects.h
parent808d6383ba175b05ac80ec9bf0daad77c36cf4be (diff)
parent05f802717a9f4e1d25754c94d518ebdd9ae5eb61 (diff)
downloadPROJ-7e2254310615a2830e1ecfd5d7538227b01d5657.tar.gz
PROJ-7e2254310615a2830e1ecfd5d7538227b01d5657.zip
Merge pull request #387 from micahcochran/math_constants2
Change math constants, similar to PR #372. Use M_ namespace with the…
Diffstat (limited to 'src/projects.h')
-rw-r--r--src/projects.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/projects.h b/src/projects.h
index 2957f848..9aca7d95 100644
--- a/src/projects.h
+++ b/src/projects.h
@@ -92,11 +92,21 @@ extern double hypot(double, double);
# define hypot _hypot
#endif
- /* some useful constants */
-#define HALFPI 1.5707963267948966
-#define FORTPI 0.78539816339744833
-#define PI 3.14159265358979323846
-#define TWOPI 6.2831853071795864769
+/* enable predefined math constants M_* for MS Visual Studio workaround */
+#ifdef _MSC_VER
+#define _USE_MATH_DEFINES
+#endif
+
+/* some more useful math constants and aliases */
+#define M_FORTPI M_PI_4 /* pi/4 */
+#define M_HALFPI M_PI_2 /* pi/2 */
+/* M_PI pi */
+#define M_PI_HALFPI 4.71238898038468985769 /* 1.5*pi */
+#define M_TWOPI 6.28318530717958647693 /* 2*pi */
+#define M_TWO_D_PI M_2_PI /* 2/pi */
+#define M_TWOPI_HALFPI 7.85398163397448309616 /* 2.5*pi */
+/* M_SQRT2 sqrt(2) */
+
/* maximum tag id length for +init and default files */
#ifndef ID_TAG_MAX