diff options
author | Nobuyoshi Nakada <[email protected]> | 2021-08-27 10:52:02 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2021-08-27 12:41:30 +0900 |
commit | 04be8e84db1cf4f8b2a7bc7679eda4336da75d43 (patch) | |
tree | c7914614f4a5cf91109f7893b87ff9e5d143ad0e /rational.c | |
parent | 37114673623c4d2b1d9f2c2ddfffba070b2d96e6 (diff) |
Use C99-defined macros to classify a floating-point number
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4783
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rational.c b/rational.c index 88693d94c4..b79809dc0e 100644 --- a/rational.c +++ b/rational.c @@ -2096,7 +2096,7 @@ rb_float_numerator(VALUE self) { double d = RFLOAT_VALUE(self); VALUE r; - if (isinf(d) || isnan(d)) + if (!isfinite(d)) return self; r = float_to_r(self); return nurat_numerator(r); @@ -2116,7 +2116,7 @@ rb_float_denominator(VALUE self) { double d = RFLOAT_VALUE(self); VALUE r; - if (isinf(d) || isnan(d)) + if (!isfinite(d)) return INT2FIX(1); r = float_to_r(self); return nurat_denominator(r); |