summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
Diffstat (limited to 'math.c')
-rw-r--r--math.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/math.c b/math.c
index 5096ba6681..09c9c8cf10 100644
--- a/math.c
+++ b/math.c
@@ -100,7 +100,6 @@ Fmath_sqrt(obj, x)
struct RFloat *x;
{
Need_Float(x);
- return float_new(log10(x->value));
if (x->value < 0.0) Fail("square root for negative number");
return float_new(sqrt(x->value));
@@ -110,15 +109,13 @@ Init_Math()
{
M_Math = rb_define_module("Math");
- rb_define_method(M_Math, "atan2", Fmath_atan2, 2);
- rb_define_method(M_Math, "cos", Fmath_cos, 1);
- rb_define_method(M_Math, "sin", Fmath_sin, 1);
- rb_define_method(M_Math, "tan", Fmath_tan, 1);
-
- rb_define_method(M_Math, "exp", Fmath_exp, 1);
- rb_define_method(M_Math, "log", Fmath_log, 1);
- rb_define_method(M_Math, "log10", Fmath_log10, 1);
- rb_define_method(M_Math, "sqrt", Fmath_sqrt, 1);
+ rb_define_module_function(M_Math, "atan2", Fmath_atan2, 2);
+ rb_define_module_function(M_Math, "cos", Fmath_cos, 1);
+ rb_define_module_function(M_Math, "sin", Fmath_sin, 1);
+ rb_define_module_function(M_Math, "tan", Fmath_tan, 1);
- rb_include_module(CLASS_OF(M_Math), M_Math);
+ rb_define_module_function(M_Math, "exp", Fmath_exp, 1);
+ rb_define_module_function(M_Math, "log", Fmath_log, 1);
+ rb_define_module_function(M_Math, "log10", Fmath_log10, 1);
+ rb_define_module_function(M_Math, "sqrt", Fmath_sqrt, 1);
}