summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 11:46:40 (GMT)
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 11:46:40 (GMT)
commitfff1183ffefc1cc29860672eb39992a942c33dfb (patch)
tree372546bcea5a90bcd1aba0d556742ee09f20add7 /rational.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 'rational.c')
-rw-r--r--rational.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/rational.c b/rational.c
index 50c4c86..632dc90 100644
--- a/rational.c
+++ b/rational.c
@@ -1428,6 +1428,13 @@ nurat_marshal_load(VALUE self, VALUE a)
/* --- */
+VALUE
+rb_rational_reciprocal(VALUE x)
+{
+ get_dat1(x);
+ return f_rational_new_no_reduce2(CLASS_OF(x), dat->den, dat->num);
+}
+
/*
* call-seq:
* int.gcd(int2) -> integer