summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKenta Murata <mrkn@mrkn.jp>2020-01-17 10:41:03 +0900
committerKenta Murata <mrkn@mrkn.jp>2020-01-17 10:57:21 +0900
commit47465ab1ccf48d2c905dbcf3b676e30b61cc41ca (patch)
tree365c04acbbc70374c1c6e66355dd9bbf3b8eb462 /ext
parent73618d84e807b4157e0ba44e9a09e4c643de6c2c (diff)
rb_rational_raw: make a denominator always positive
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/rational/rat.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/rational/rat.c b/ext/-test-/rational/rat.c
index 0138834..b1ffbda 100644
--- a/ext/-test-/rational/rat.c
+++ b/ext/-test-/rational/rat.c
@@ -29,9 +29,17 @@ gcd_gmp(VALUE x, VALUE y)
#define gcd_gmp rb_f_notimplement
#endif
+static VALUE
+s_rational_raw(VALUE klass, VALUE x, VALUE y)
+{
+ return rb_rational_raw(x, y);
+}
+
void
Init_rational(VALUE klass)
{
rb_define_method(rb_cInteger, "gcd_normal", gcd_normal, 1);
rb_define_method(rb_cInteger, "gcd_gmp", gcd_gmp, 1);
+
+ rb_define_singleton_method(rb_cRational, "raw", s_rational_raw, 2);
}