Permalink
Browse files

a quick optimization

  • Loading branch information...
1 parent c170c86 commit 8397cfbbff22657083c7beb79a0f23f277011266 @lrz lrz committed Aug 4, 2009
Showing with 3 additions and 0 deletions.
  1. +3 −0 math.c
View
3 math.c
@@ -18,6 +18,9 @@ VALUE rb_mMath;
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" :

0 comments on commit 8397cfb

Please sign in to comment.