diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 11:51:04 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-31 11:51:04 +0000 |
commit | 1d9a079b1c3b54da5935201c796c7cdb423ed4c8 (patch) | |
tree | 3d901adc26cf5a33ef274e10843560cf8f80313a /complex.c | |
parent | 8aae9dc62c4c32219be8bb2afd731a8cafb32b0a (diff) | |
download | ruby-1d9a079b1c3b54da5935201c796c7cdb423ed4c8.tar.gz |
* 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.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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); |