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

ruby-changes:12131

From: yugui <ko1@a...>
Date: Sun, 21 Jun 2009 19:36:06 +0900 (JST)
Subject: [ruby-changes:12131] Ruby:r23803 (ruby_1_9_1): merges r23742 from trunk into ruby_1_9_1.

yugui	2009-06-21 19:35:50 +0900 (Sun, 21 Jun 2009)

  New Revision: 23803

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

  Log:
    merges r23742 from trunk into ruby_1_9_1.
    --
    * numeric.c (flo_cmp): should always return nil for NaN.
    * numeric.c (flo_cmp): handle infinite value specially using
      infinite? method internally.  [ruby-dev:38681]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/numeric.c
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 23802)
+++ ruby_1_9_1/ChangeLog	(revision 23803)
@@ -1,3 +1,10 @@
+Fri Jun 19 17:04:59 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* numeric.c (flo_cmp): should always return nil for NaN.
+
+	* numeric.c (flo_cmp): handle infinite value specially using
+	  infinite? method internally.  [ruby-dev:38681]
+
 Fri Jun 19 09:28:45 2009  Tadayoshi Funaba  <tadf@d...>
 
 	* numeric.c (*_numerator,*_denominator): moved to rational.c.
Index: ruby_1_9_1/numeric.c
===================================================================
--- ruby_1_9_1/numeric.c	(revision 23802)
+++ ruby_1_9_1/numeric.c	(revision 23803)
@@ -926,6 +926,7 @@
     double a, b;
 
     a = RFLOAT_VALUE(x);
+    if (isnan(a)) return Qnil;
     switch (TYPE(y)) {
       case T_FIXNUM:
 	b = (double)FIX2LONG(y);
@@ -944,6 +945,11 @@
 	break;
 
       default:
+	if (isinf(a) && (!rb_respond_to(y, rb_intern("infinite?")) ||
+			 !RTEST(rb_funcall(y, rb_intern("infinite?"), 0, 0)))) {
+	    if (a > 0.0) return INT2FIX(1);
+	    return INT2FIX(-1);
+	}
 	return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
     }
     return rb_dbl_cmp(a, b);
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 23802)
+++ ruby_1_9_1/version.h	(revision 23803)
@@ -1,6 +1,6 @@
 #define RUBY_VERSION "1.9.1"
 #define RUBY_RELEASE_DATE "2009-05-22"
-#define RUBY_PATCHLEVEL 193
+#define RUBY_PATCHLEVEL 194
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1

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

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