summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <matz@ruby-lang.org>1994-10-14 06:19:03 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2019-08-17 22:09:30 +0900
commit29f237a8b1df650089b54447f070726c75706b6f (patch)
treee6ee836a39a5f2f1d433d6532de32471b655fb6d /math.c
parent173976c97c9426aa8d96e53aef6c0e570c5fdfda (diff)
version 0.54v0_54
https://cache.ruby-lang.org/pub/ruby/1.0/ruby-0.54.tar.gz
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 5096ba6..09c9c8c 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);
}