aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-20 03:16:59 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-20 03:16:59 +0000
commita91825967fc7a2fe2c9d2df3de5fe4455835ec9f (patch)
treefa81b2fb7d4c4341125ccc830764c18da15339c9 /numeric.c
parent32eab2c92883320cfcbbfa7b684f954506385787 (diff)
downloadruby-a91825967fc7a2fe2c9d2df3de5fe4455835ec9f.tar.gz
add missing/nan.c
instead of scattering #ifdef HAVE_NANF here and there define our own nan() unless defined elsewhere. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/numeric.c b/numeric.c
index e7b1a69d4d..a7769ca255 100644
--- a/numeric.c
+++ b/numeric.c
@@ -3651,11 +3651,7 @@ rb_int_fdiv_double(VALUE x, VALUE y)
return rb_big_fdiv_double(x, y);
}
else {
-#ifdef HAVE_NANF
return nan("");
-#else
- return (double)NAN;
-#endif
}
}
@@ -5565,13 +5561,7 @@ Init_Numeric(void)
/*
* An expression representing a value which is "not a number".
*/
- rb_define_const(rb_cFloat, "NAN",
-#ifdef HAVE_NANF
- DBL2NUM(nan(""))
-#else
- DBL2NUM((double)NAN)
-#endif
- );
+ rb_define_const(rb_cFloat, "NAN", DBL2NUM(nan("")));
rb_define_method(rb_cFloat, "to_s", flo_to_s, 0);
rb_define_alias(rb_cFloat, "inspect", "to_s");