diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-06-29 01:01:17 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-06-29 01:01:17 -0700 |
| commit | 5698852e1c3002f40198abf5e7a37c3ef1392690 (patch) | |
| tree | 6fc0c4ca660e88669d0bd2f6f15656c49263ac31 /mrbgems/mruby-math/src/math.c | |
| parent | 9f154dd7f47a64dcce867115ed92145e833e8f6e (diff) | |
| parent | bc91bcefcfc0b509cdfa2cd550a395314e280566 (diff) | |
| download | mruby-5698852e1c3002f40198abf5e7a37c3ef1392690.tar.gz mruby-5698852e1c3002f40198abf5e7a37c3ef1392690.zip | |
Merge pull request #1311 from cremno/msvc-2013-support
Visual Studio 2013 support (and two other fixes)
Diffstat (limited to 'mrbgems/mruby-math/src/math.c')
| -rw-r--r-- | mrbgems/mruby-math/src/math.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index bf3c007b4..bdc7767f7 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -12,8 +12,8 @@ #define domain_error(msg) \ mrb_raise(mrb, E_RANGE_ERROR, "Numerical argument is out of domain - " #msg) -/* math functions not provided under Microsoft Visual C++ */ -#ifdef _MSC_VER +/* math functions not provided by Microsoft Visual C++ 2012 or older */ +#if defined _MSC_VER && _MSC_VER < 1800 #define MATH_TOLERANCE 1E-12 @@ -87,6 +87,12 @@ erfc(double x) return one_sqrtpi*exp(-x*x)*q2; } +double +log2(double x) +{ + return log10(x)/log10(2.0); +} + #endif /* @@ -358,18 +364,6 @@ math_atanh(mrb_state *mrb, mrb_value obj) # define log10(x) ((x) < 0.0 ? nan("") : log10(x)) #endif -#ifndef log2 -#ifndef HAVE_LOG2 -double -log2(double x) -{ - return log10(x)/log10(2.0); -} -#else -extern double log2(double); -#endif -#endif - /* * call-seq: * Math.exp(x) -> float |
