From a98cbcbf0b74112ff93d9b3c25b8abebba1a91b5 Mon Sep 17 00:00:00 2001 From: shugo Date: Mon, 2 Feb 2009 03:45:28 +0000 Subject: * complex.c (f_signbit): regard NaN as a positive value. [ruby-dev:37861]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- complex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'complex.c') diff --git a/complex.c b/complex.c index 49ce51f905..180e7d23c9 100644 --- a/complex.c +++ b/complex.c @@ -894,8 +894,10 @@ f_signbit(VALUE x) #else { char s[2]; + double f = RFLOAT_VALUE(x); - (void)snprintf(s, sizeof s, "%.0f", RFLOAT_VALUE(x)); + if (isnan(f)) return Qfalse; + (void)snprintf(s, sizeof s, "%.0f", f); return f_boolcast(s[0] == '-'); } #endif -- cgit v1.2.3