summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-31 11:51:04 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-08-31 11:51:04 +0000
commit1d9a079b1c3b54da5935201c796c7cdb423ed4c8 (patch)
tree3d901adc26cf5a33ef274e10843560cf8f80313a /complex.c
parent8aae9dc62c4c32219be8bb2afd731a8cafb32b0a (diff)
* complex.c (numeric_abs2): new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/complex.c b/complex.c
index 39e8ad2f85..34255df9fd 100644
--- a/complex.c
+++ b/complex.c
@@ -1291,6 +1291,12 @@ numeric_image(VALUE self)
return INT2FIX(0);
}
+static VALUE
+numeric_abs2(VALUE self)
+{
+ return f_mul(self, self);
+}
+
#define id_PI rb_intern("PI")
static VALUE
@@ -1473,6 +1479,7 @@ Init_Complex(void)
rb_define_method(rb_cNumeric, "real", numeric_real, 0);
rb_define_method(rb_cNumeric, "image", numeric_image, 0);
rb_define_method(rb_cNumeric, "imag", numeric_image, 0);
+ rb_define_method(rb_cNumeric, "abs2", numeric_abs2, 0);
rb_define_method(rb_cNumeric, "arg", numeric_arg, 0);
rb_define_method(rb_cNumeric, "angle", numeric_arg, 0);
rb_define_method(rb_cNumeric, "phase", numeric_arg, 0);