rational.c (nurat_div): use the dedicated function nurat_to_f
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
33758ded08
commit
ed778c2a89
@ -41,6 +41,8 @@ static ID id_abs, id_idiv, id_integer_p,
|
|||||||
#define f_inspect rb_inspect
|
#define f_inspect rb_inspect
|
||||||
#define f_to_s rb_obj_as_string
|
#define f_to_s rb_obj_as_string
|
||||||
|
|
||||||
|
static VALUE nurat_to_f(VALUE self);
|
||||||
|
|
||||||
#define binop(n,op) \
|
#define binop(n,op) \
|
||||||
inline static VALUE \
|
inline static VALUE \
|
||||||
f_##n(VALUE x, VALUE y)\
|
f_##n(VALUE x, VALUE y)\
|
||||||
@ -930,8 +932,7 @@ nurat_div(VALUE self, VALUE other)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RB_FLOAT_TYPE_P(other)) {
|
else if (RB_FLOAT_TYPE_P(other)) {
|
||||||
double d = nurat_to_double(self);
|
VALUE v = nurat_to_f(self);
|
||||||
VALUE v = rb_float_new(d);
|
|
||||||
return rb_flo_div_flo(v, other);
|
return rb_flo_div_flo(v, other);
|
||||||
}
|
}
|
||||||
else if (RB_TYPE_P(other, T_RATIONAL)) {
|
else if (RB_TYPE_P(other, T_RATIONAL)) {
|
||||||
@ -954,8 +955,6 @@ nurat_div(VALUE self, VALUE other)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE nurat_to_f(VALUE self);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* rat.fdiv(numeric) -> float
|
* rat.fdiv(numeric) -> float
|
||||||
|
Loading…
x
Reference in New Issue
Block a user