aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--complex.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 48f746b64b..a863d16c81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 2 12:41:52 2009 Shugo Maeda <shugo@ruby-lang.org>
+
+ * complex.c (f_signbit): regard NaN as a positive value.
+ [ruby-dev:37861].
+
Mon Feb 2 12:39:00 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sample/test.rb (valid_syntax?), test/ruby/test_system.rb
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