diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-16 08:15:05 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-16 08:15:05 +0900 |
commit | ca524bcd494e2f284c3211cad8e8dde70e8aa86a (patch) | |
tree | 0b64cd0673bacdb2209c7b5e8e97244e7f3f38f9 /complex.c | |
parent | 34019a22eb41206e3d5d1ac29b3874275aa7f71c (diff) | |
download | bundler-ca524bcd494e2f284c3211cad8e8dde70e8aa86a.tar.gz |
Expanded f_numerator
Diffstat (limited to 'complex.c')
-rw-r--r-- | complex.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -192,6 +192,18 @@ f_arg(VALUE x) } 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) { if (RB_TYPE_P(x, T_RATIONAL)) { @@ -221,7 +233,6 @@ f_negate(VALUE x) return rb_funcall(x, id_negate, 0); } -fun1(numerator) fun1(real_p) inline static VALUE |