1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Renamed nurat_sub compliant with rb_rational_plus

This commit is contained in:
Nobuyoshi Nakada 2020-05-30 18:34:32 +09:00
parent 53d2bfd540
commit 254bed3027
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 4 additions and 3 deletions

View file

@ -27,6 +27,7 @@ struct RRational {
VALUE rb_rational_canonicalize(VALUE x); VALUE rb_rational_canonicalize(VALUE x);
VALUE rb_rational_uminus(VALUE self); VALUE rb_rational_uminus(VALUE self);
VALUE rb_rational_plus(VALUE self, VALUE other); VALUE rb_rational_plus(VALUE self, VALUE other);
VALUE rb_rational_minus(VALUE self, VALUE other);
VALUE rb_rational_mul(VALUE self, VALUE other); VALUE rb_rational_mul(VALUE self, VALUE other);
VALUE rb_lcm(VALUE x, VALUE y); VALUE rb_lcm(VALUE x, VALUE y);
VALUE rb_rational_reciprocal(VALUE x); VALUE rb_rational_reciprocal(VALUE x);

View file

@ -771,8 +771,8 @@ rb_rational_plus(VALUE self, VALUE other)
* Rational(9, 8) - 4 #=> (-23/8) * Rational(9, 8) - 4 #=> (-23/8)
* Rational(20, 9) - 9.8 #=> -7.577777777777778 * Rational(20, 9) - 9.8 #=> -7.577777777777778
*/ */
static VALUE VALUE
nurat_sub(VALUE self, VALUE other) rb_rational_minus(VALUE self, VALUE other)
{ {
if (RB_INTEGER_TYPE_P(other)) { if (RB_INTEGER_TYPE_P(other)) {
{ {
@ -2731,7 +2731,7 @@ Init_Rational(void)
rb_define_method(rb_cRational, "-@", rb_rational_uminus, 0); rb_define_method(rb_cRational, "-@", rb_rational_uminus, 0);
rb_define_method(rb_cRational, "+", rb_rational_plus, 1); rb_define_method(rb_cRational, "+", rb_rational_plus, 1);
rb_define_method(rb_cRational, "-", nurat_sub, 1); rb_define_method(rb_cRational, "-", rb_rational_minus, 1);
rb_define_method(rb_cRational, "*", rb_rational_mul, 1); rb_define_method(rb_cRational, "*", rb_rational_mul, 1);
rb_define_method(rb_cRational, "/", nurat_div, 1); rb_define_method(rb_cRational, "/", nurat_div, 1);
rb_define_method(rb_cRational, "quo", nurat_div, 1); rb_define_method(rb_cRational, "quo", nurat_div, 1);