diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-03-03 04:28:58 -0800 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2013-03-03 04:28:58 -0800 |
| commit | 4354999fc628d248da85eaf7caf4e951cb421c92 (patch) | |
| tree | e9b051e73cc45f58a1ca2964e33228803752e497 /mrbgems | |
| parent | bc46c374b40354b1f1320d5bea75fd852d0ea9ed (diff) | |
| parent | 6cd7017ec11b0cbe40e8dbe462e5eda9ad7ce97c (diff) | |
| download | mruby-4354999fc628d248da85eaf7caf4e951cb421c92.tar.gz mruby-4354999fc628d248da85eaf7caf4e951cb421c92.zip | |
Merge pull request #933 from monaka/pr-remove-trailing-whitespaces-20130303
Remove trailing whitespaces. This is just a cosmetic change.
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-math/src/math.c | 40 | ||||
| -rw-r--r-- | mrbgems/mruby-struct/src/struct.c | 6 |
2 files changed, 23 insertions, 23 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)); diff --git a/mrbgems/mruby-struct/src/struct.c b/mrbgems/mruby-struct/src/struct.c index a49d8244b..33997b294 100644 --- a/mrbgems/mruby-struct/src/struct.c +++ b/mrbgems/mruby-struct/src/struct.c @@ -352,8 +352,8 @@ mrb_struct_s_def(mrb_state *mrb, mrb_value klass) mrb_get_args(mrb, "*&", &argv, &argc, &b); if (argc == 0) { /* special case to avoid crash */ rest = mrb_ary_new(mrb); - } - else { + } + else { if (argc > 0) name = argv[0]; if (argc > 1) rest = argv[1]; if (mrb_array_p(rest)) { @@ -378,7 +378,7 @@ mrb_struct_s_def(mrb_state *mrb, mrb_value klass) id = mrb_to_id(mrb, RARRAY_PTR(rest)[i]); RARRAY_PTR(rest)[i] = mrb_symbol_value(id); } - } + } st = make_struct(mrb, name, rest, struct_class(mrb)); if (!mrb_nil_p(b)) { mrb_funcall(mrb, b, "call", 1, &st); |
