summaryrefslogtreecommitdiff
path: root/complex.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 11:46:40 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 11:46:40 +0000
commitfff1183ffefc1cc29860672eb39992a942c33dfb (patch)
tree372546bcea5a90bcd1aba0d556742ee09f20add7 /complex.c
parent17c1e454055eaa8e6884e23a195a5fc65ed4277f (diff)
* numeric.c (fix_divide): added an entry to rational.
* rational.c (rb_rational_reciprocal): added. * complex.c (f_reciprocal): added. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'complex.c')
-rw-r--r--complex.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index 9d9e90c02e..f8c0ecd1c2 100644
--- a/complex.c
+++ b/complex.c
@@ -812,6 +812,12 @@ rb_fexpt(VALUE x, VALUE y)
return m_exp(f_mul(m_log(x), y));
}
+inline static VALUE
+f_reciprocal(VALUE x)
+{
+ return f_quo(ONE, x);
+}
+
/*
* call-seq:
* cmp ** numeric -> complex
@@ -879,7 +885,7 @@ nucomp_expt(VALUE self, VALUE other)
}
return z;
}
- return f_expt(f_div(f_to_r(ONE), self), f_negate(other));
+ return f_expt(f_reciprocal(self), f_negate(other));
}
if (k_numeric_p(other) && f_real_p(other)) {
VALUE r, theta;