diff options
| author | Masaki Muranaka <[email protected]> | 2013-03-03 10:54:00 +0900 |
|---|---|---|
| committer | Masaki Muranaka <[email protected]> | 2013-03-03 10:54:00 +0900 |
| commit | 6cd7017ec11b0cbe40e8dbe462e5eda9ad7ce97c (patch) | |
| tree | e9b051e73cc45f58a1ca2964e33228803752e497 /mrbgems/mruby-math | |
| parent | bc46c374b40354b1f1320d5bea75fd852d0ea9ed (diff) | |
| download | mruby-6cd7017ec11b0cbe40e8dbe462e5eda9ad7ce97c.tar.gz mruby-6cd7017ec11b0cbe40e8dbe462e5eda9ad7ce97c.zip | |
Remove trailing whitespaces. This is just a cosmetic change.
Diffstat (limited to 'mrbgems/mruby-math')
| -rw-r--r-- | mrbgems/mruby-math/src/math.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c index 9955d9862..76058250f 100644 --- a/mrbgems/mruby-math/src/math.c +++ b/mrbgems/mruby-math/src/math.c @@ -26,13 +26,13 @@ double erfc(double x); -/* +/* ** Implementations of error functions ** credits to http://www.digitalmars.com/archives/cplusplus/3634.html */ /* Implementation of Error function */ -double +double erf(double x) { static const double two_sqrtpi = 1.128379167095512574; @@ -55,24 +55,24 @@ erf(double x) } /* Implementation of complementary Error function */ -double +double erfc(double x) { - static const double one_sqrtpi= 0.564189583547756287; - double a = 1; - double b = x; - double c = x; - double d = x*x+0.5; + static const double one_sqrtpi= 0.564189583547756287; + double a = 1; + double b = x; + double c = x; + double d = x*x+0.5; double q1; double q2 = b/d; double n = 1.0; double t; if (fabs(x) < 2.2) { - return 1.0 - erf(x); - } - if (x < 0.0) { /*signbit(x)*/ - return 2.0 - erfc(-x); - } + return 1.0 - erf(x); + } + if (x < 0.0) { /*signbit(x)*/ + return 2.0 - erfc(-x); + } do { t = a*n+b*x; a = b; @@ -306,7 +306,7 @@ math_asinh(mrb_state *mrb, mrb_value obj) mrb_float x; mrb_get_args(mrb, "f", &x); - + x = asinh(x); return mrb_float_value(x); @@ -477,10 +477,10 @@ static mrb_value math_sqrt(mrb_state *mrb, mrb_value obj) { mrb_float x; - + mrb_get_args(mrb, "f", &x); x = sqrt(x); - + return mrb_float_value(x); } @@ -544,7 +544,7 @@ math_frexp(mrb_state *mrb, mrb_value obj) { mrb_float x; int exp; - + mrb_get_args(mrb, "f", &x); x = frexp(x, &exp); @@ -633,13 +633,13 @@ mrb_mruby_math_gem_init(mrb_state* mrb) { struct RClass *mrb_math; mrb_math = mrb_define_module(mrb, "Math"); - + #ifdef M_PI mrb_define_const(mrb, mrb_math, "PI", mrb_float_value(M_PI)); #else mrb_define_const(mrb, mrb_math, "PI", mrb_float_value(atan(1.0)*4.0)); #endif - + #ifdef M_E mrb_define_const(mrb, mrb_math, "E", mrb_float_value(M_E)); #else @@ -660,7 +660,7 @@ mrb_mruby_math_gem_init(mrb_state* mrb) mrb_define_module_function(mrb, mrb_math, "acos", math_acos, ARGS_REQ(1)); mrb_define_module_function(mrb, mrb_math, "atan", math_atan, ARGS_REQ(1)); mrb_define_module_function(mrb, mrb_math, "atan2", math_atan2, ARGS_REQ(2)); - + mrb_define_module_function(mrb, mrb_math, "sinh", math_sinh, ARGS_REQ(1)); mrb_define_module_function(mrb, mrb_math, "cosh", math_cosh, ARGS_REQ(1)); mrb_define_module_function(mrb, mrb_math, "tanh", math_tanh, ARGS_REQ(1)); |
