From 6419dce2830bd56554bd5286aaa7d855022b67e9 Mon Sep 17 00:00:00 2001 From: yugui Date: Mon, 2 Feb 2009 08:07:39 +0000 Subject: merges r21945 from trunk into ruby_1_9_1. * complex.c (f_signbit): regard NaN as a positive value. [ruby-dev:37861]. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ complex.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6a522000c..978f61b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 2 12:41:52 2009 Shugo Maeda + + * complex.c (f_signbit): regard NaN as a positive value. + [ruby-dev:37861]. + Mon Feb 2 06:51:36 2009 NAKAMURA Usaku * encoding.c (rb_filesystem_encoding): Windows' filesystem encoding is diff --git a/complex.c b/complex.c index 390658b48..b3b55c685 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