aboutsummaryrefslogtreecommitdiffstats
path: root/marshal.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 /marshal.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 'marshal.c')
-rw-r--r--marshal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/marshal.c b/marshal.c
index a7eb3edc8a..c6c3922283 100644
--- a/marshal.c
+++ b/marshal.c
@@ -1678,13 +1678,18 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
const char *ptr = RSTRING_PTR(str);
if (strcmp(ptr, "nan") == 0) {
- d = NAN;
+ d =
+#ifdef HAVE_NANF
+ nan("");
+#else
+ (double)NAN;
+#endif
}
else if (strcmp(ptr, "inf") == 0) {
- d = INFINITY;
+ d = HUGE_VAL;
}
else if (strcmp(ptr, "-inf") == 0) {
- d = -INFINITY;
+ d = -HUGE_VAL;
}
else {
char *e;