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

rational.c: optimize (-rational).rationalize(some)

* rational.c (nurat_rationalize): optimize (-rational).rationalize(some).
  Author: Tadashi Saito <tad.a.digger@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2016-11-12 15:43:18 +00:00
parent f3364f711e
commit edfa67c248

View file

@ -1616,8 +1616,8 @@ nurat_rationalize(int argc, VALUE *argv, VALUE self)
if (argc == 0)
return self;
if (f_negative_p(self))
return f_negate(nurat_rationalize(argc, argv, f_abs(self)));
if (nurat_negative_p(self))
return nurat_negate(nurat_rationalize(argc, argv, nurat_negate(self)));
rb_scan_args(argc, argv, "01", &e);
e = f_abs(e);