mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rational.c: optimize rational - integer
* rational.c (nurat_sub): optimize rational - integer. Author: Tadashi Saito <tad.a.digger@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d028d6984f
commit
b848f3c7e1
1 changed files with 3 additions and 3 deletions
|
@ -782,9 +782,9 @@ nurat_sub(VALUE self, VALUE other)
|
||||||
{
|
{
|
||||||
get_dat1(self);
|
get_dat1(self);
|
||||||
|
|
||||||
return f_addsub(self,
|
return f_rational_new_no_reduce2(CLASS_OF(self),
|
||||||
dat->num, dat->den,
|
rb_int_minus(dat->num, rb_int_mul(other, dat->den)),
|
||||||
other, ONE, '-');
|
dat->den);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RB_TYPE_P(other, T_FLOAT)) {
|
else if (RB_TYPE_P(other, T_FLOAT)) {
|
||||||
|
|
Loading…
Reference in a new issue