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

ruby-changes:9691

From: yugui <ko1@a...>
Date: Thu, 1 Jan 2009 15:43:21 +0900 (JST)
Subject: [ruby-changes:9691] Ruby:r21232 (ruby_1_9_1): merges r21214 from trunk into ruby_1_9_1.

yugui	2009-01-01 15:42:59 +0900 (Thu, 01 Jan 2009)

  New Revision: 21232

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

  Log:
    merges r21214 from trunk into ruby_1_9_1.
    * object.c (rb_to_float): replaced by to_flo definition from
      math.c  [ruby-dev:37668]
    * math.c (Need_Float): use rb_to_float().

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/math.c
    branches/ruby_1_9_1/object.c

Index: ruby_1_9_1/math.c
===================================================================
--- ruby_1_9_1/math.c	(revision 21231)
+++ ruby_1_9_1/math.c	(revision 21232)
@@ -15,20 +15,7 @@
 
 VALUE rb_mMath;
 
-static VALUE
-to_flo(VALUE x)
-{
-    if (!rb_obj_is_kind_of(x, rb_cNumeric)) {
-	rb_raise(rb_eTypeError, "can't convert %s into Float",
-		 NIL_P(x) ? "nil" :
-		 x == Qtrue ? "true" :
-		 x == Qfalse ? "false" :
-		 rb_obj_classname(x));
-    }
-    return rb_convert_type(x, T_FLOAT, "Float", "to_f");
-}
-
-#define Need_Float(x) (x) = to_flo(x)
+#define Need_Float(x) (x) = rb_to_float(x)
 #define Need_Float2(x,y) do {\
     Need_Float(x);\
     Need_Float(y);\
Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 21231)
+++ ruby_1_9_1/ChangeLog	(revision 21232)
@@ -1,3 +1,10 @@
+Wed Dec 31 14:12:35 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* object.c (rb_to_float): replaced by to_flo definition from
+	  math.c  [ruby-dev:37668]
+
+	* math.c (Need_Float): use rb_to_float().
+
 Wed Dec 31 19:35:57 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* spec/README: follows the change of directory structure in rubyspec.
Index: ruby_1_9_1/object.c
===================================================================
--- ruby_1_9_1/object.c	(revision 21231)
+++ ruby_1_9_1/object.c	(revision 21232)
@@ -2267,6 +2267,20 @@
     return rb_Float(arg);
 }
 
+VALUE
+rb_to_float(VALUE val)
+{
+    if (TYPE(val) == T_FLOAT) return val;
+    if (!rb_obj_is_kind_of(val, rb_cNumeric)) {
+	rb_raise(rb_eTypeError, "can't convert %s into Float",
+		 NIL_P(val) ? "nil" :
+		 val == Qtrue ? "true" :
+		 val == Qfalse ? "false" :
+		 rb_obj_classname(val));
+    }
+    return rb_convert_type(val, T_FLOAT, "Float", "to_f");
+}
+
 double
 rb_num2dbl(VALUE val)
 {

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

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