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

ruby-changes:12263

From: matz <ko1@a...>
Date: Sat, 4 Jul 2009 09:46:34 +0900 (JST)
Subject: [ruby-changes:12263] Ruby:r23953 (trunk): * numeric.c (dbl2ival): should raise FloatDomainError on Infinity

matz	2009-07-04 09:46:14 +0900 (Sat, 04 Jul 2009)

  New Revision: 23953

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

  Log:
    * numeric.c (dbl2ival): should raise FloatDomainError on Infinity
      and NaN as 1.8 does.  [ruby-dev:38726]

  Modified files:
    trunk/ChangeLog
    trunk/numeric.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23952)
+++ ChangeLog	(revision 23953)
@@ -1,3 +1,8 @@
+Sat Jul  4 08:20:03 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* numeric.c (dbl2ival): should raise FloatDomainError on Infinity
+	  and NaN as 1.8 does.  [ruby-dev:38726]
+
 Fri Jul  3 22:48:45 2009  Tanaka Akira  <akr@f...>
 
 	* time.c (find_time_t): less number of guesses for hh:mm:60.
Index: numeric.c
===================================================================
--- numeric.c	(revision 23952)
+++ numeric.c	(revision 23953)
@@ -756,13 +756,7 @@
 	d = round(d);
 	return LONG2FIX((long)d);
     }
-    else if (isnan(d) || isinf(d)) {
-	/* special case: cannot return integer value */
-	return rb_float_new(d);
-    }
-    else {
-	return rb_dbl2big(d);
-    }
+    return rb_dbl2big(d);
 }
 
 /*

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

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