[前][次][番号順一覧][スレッド一覧]

ruby-changes:10401

From: shugo <ko1@a...>
Date: Mon, 2 Feb 2009 12:45:38 +0900 (JST)
Subject: [ruby-changes:10401] Ruby:r21945 (trunk): * complex.c (f_signbit): regard NaN as a positive value.

shugo	2009-02-02 12:45:28 +0900 (Mon, 02 Feb 2009)

  New Revision: 21945

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21945

  Log:
    * complex.c (f_signbit): regard NaN as a positive value.
      [ruby-dev:37861].

  Modified files:
    trunk/ChangeLog
    trunk/complex.c

Index: complex.c
===================================================================
--- complex.c	(revision 21944)
+++ complex.c	(revision 21945)
@@ -894,8 +894,10 @@
 #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
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 21944)
+++ ChangeLog	(revision 21945)
@@ -1,3 +1,8 @@
+Mon Feb  2 12:41:52 2009  Shugo Maeda  <shugo@r...>
+
+	* complex.c (f_signbit): regard NaN as a positive value.
+	  [ruby-dev:37861].
+
 Mon Feb  2 12:39:00 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* sample/test.rb (valid_syntax?), test/ruby/test_system.rb

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]