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

Remove wrong conversion

* rational.c (nurat_to_double): should return `double`, not `Float`.
  fix r64897.  [Bug #15189]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-10-05 00:37:40 +00:00
parent 4484390f9b
commit 6918746e46

View file

@ -1556,8 +1556,7 @@ nurat_to_double(VALUE self)
{
get_dat1(self);
if (!RB_INTEGER_TYPE_P(dat->num) || !RB_INTEGER_TYPE_P(dat->den)) {
double d = NUM2DBL(dat->num) / NUM2DBL(dat->den);
return DBL2NUM(d);
return NUM2DBL(dat->num) / NUM2DBL(dat->den);
}
return rb_int_fdiv_double(dat->num, dat->den);
}