summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--complex.c2
-rw-r--r--include/ruby/missing.h7
-rw-r--r--math.c3
3 files changed, 8 insertions, 4 deletions
diff --git a/complex.c b/complex.c
index 50d53afcde..beaf6713a1 100644
--- a/complex.c
+++ b/complex.c
@@ -5,12 +5,12 @@
which is written in ruby.
*/
-#include "internal.h"
#if defined _MSC_VER
/* Microsoft Visual C does not define M_PI and others by default */
# define _USE_MATH_DEFINES 1
#endif
#include <math.h>
+#include "internal.h"
#define NDEBUG
#include <assert.h>
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 161d95430a..f9e9daed3a 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -37,6 +37,13 @@ extern "C" {
#endif
#endif
+#ifndef M_PI
+# define M_PI 3.14159265358979323846
+#endif
+#ifndef M_PI_2
+# define M_PI_2 (M_PI/2)
+#endif
+
#ifndef RUBY_SYMBOL_EXPORT_BEGIN
# define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
# define RUBY_SYMBOL_EXPORT_END /* end */
diff --git a/math.c b/math.c
index 22bd731745..134d937358 100644
--- a/math.c
+++ b/math.c
@@ -106,9 +106,6 @@ num2dbl_with_to_f(VALUE num)
static VALUE
math_atan2(VALUE obj, VALUE y, VALUE x)
{
-#ifndef M_PI
-# define M_PI 3.14159265358979323846
-#endif
double dx, dy;
dx = Get_Double(x);
dy = Get_Double(y);