mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Expanded f_numerator
This commit is contained in:
parent
34019a22eb
commit
ca524bcd49
3 changed files with 16 additions and 4 deletions
13
complex.c
13
complex.c
|
@ -191,6 +191,18 @@ f_arg(VALUE x)
|
|||
return rb_funcall(x, id_arg, 0);
|
||||
}
|
||||
|
||||
inline static VALUE
|
||||
f_numerator(VALUE x)
|
||||
{
|
||||
if (RB_TYPE_P(x, T_RATIONAL)) {
|
||||
return RRATIONAL(x)->num;
|
||||
}
|
||||
if (RB_FLOAT_TYPE_P(x)) {
|
||||
return rb_float_numerator(x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
inline static VALUE
|
||||
f_denominator(VALUE x)
|
||||
{
|
||||
|
@ -221,7 +233,6 @@ f_negate(VALUE x)
|
|||
return rb_funcall(x, id_negate, 0);
|
||||
}
|
||||
|
||||
fun1(numerator)
|
||||
fun1(real_p)
|
||||
|
||||
inline static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue