diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-19 01:45:36 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-01-19 01:45:36 +0000 |
commit | 3ca0948f68d1055cd980992dcb68deced0f4d704 (patch) | |
tree | 961c2602e81c6dc5f73e46a3a2d61565c4da16d8 /rational.c | |
parent | 09b4d6e8cd50dca07997d40b7e04d6652a9a4d43 (diff) |
INFINITY is float. That of double is HUGE_VAL.
It seems HUGE_VAL is already used. Why not eliminate INTINITY.
NAN is also float. That of double is called nan(). This is also
fixed.
Signed-off-by: Urabe, Shyouhei <[email protected]>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r-- | rational.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rational.c b/rational.c index 0617fd7327..c1c1081446 100644 --- a/rational.c +++ b/rational.c @@ -1072,7 +1072,12 @@ nurat_expt(VALUE self, VALUE other) den = ONE; } if (RB_FLOAT_TYPE_P(num)) { /* infinity due to overflow */ - if (RB_FLOAT_TYPE_P(den)) return DBL2NUM(NAN); + if (RB_FLOAT_TYPE_P(den)) +#ifdef HAVE_NANF + return DBL2NUM(nan("")); +#else + return DBL2NUM((double)NAN); +#endif return num; } if (RB_FLOAT_TYPE_P(den)) { /* infinity due to overflow */ |