[macruby-changes] [2199] MacRuby/branches/experimental/math.c

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 3 18:23:22 PDT 2009


Revision: 2199
          http://trac.macosforge.org/projects/ruby/changeset/2199
Author:   lsansonetti at apple.com
Date:     2009-08-03 18:23:21 -0700 (Mon, 03 Aug 2009)
Log Message:
-----------
a quick optimization

Modified Paths:
--------------
    MacRuby/branches/experimental/math.c

Modified: MacRuby/branches/experimental/math.c
===================================================================
--- MacRuby/branches/experimental/math.c	2009-08-03 23:50:42 UTC (rev 2198)
+++ MacRuby/branches/experimental/math.c	2009-08-04 01:23:21 UTC (rev 2199)
@@ -18,6 +18,9 @@
 static VALUE
 to_flo(VALUE x)
 {
+    if (CLASS_OF(x) == rb_cFloat) {
+	return x;
+    }
     if (!rb_obj_is_kind_of(x, rb_cNumeric)) {
 	rb_raise(rb_eTypeError, "can't convert %s into Float",
 		 NIL_P(x) ? "nil" :
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090803/f90940b6/attachment.html>


More information about the macruby-changes mailing list