aboutsummaryrefslogtreecommitdiffstats
path: root/rational.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 01:45:36 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-19 01:45:36 +0000
commitc81e096f5d2e31d04a412b48b23d46cef33a0866 (patch)
tree961c2602e81c6dc5f73e46a3a2d61565c4da16d8 /rational.c
parente8f19e9eb28176aba1c661d4654b217b447aa9ed (diff)
downloadruby-c81e096f5d2e31d04a412b48b23d46cef33a0866.tar.gz
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 <shyouhei@ruby-lang.org> 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.c7
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 */