diff --git a/ChangeLog b/ChangeLog index e78c50ceb5..aebe79fe78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ Tue Feb 24 00:24:13 2009 Yukihiro Matsumoto * range.c (range_each): check #succ only when it is really needed. small performance improvement. + * math.c (Need_Float): call rb_to_float() only when it is really + needed. small performance improvement. + Tue Feb 24 00:19:33 2009 Yukihiro Matsumoto * lib/pathname.rb (Pathname#foreachline): removed wrongly diff --git a/math.c b/math.c index 2043bebfe5..cc557c960c 100644 --- a/math.c +++ b/math.c @@ -16,7 +16,7 @@ VALUE rb_mMath; extern VALUE rb_to_float(VALUE val); -#define Need_Float(x) (x) = rb_to_float(x) +#define Need_Float(x) do {if (TYPE(x) != T_FLOAT) {(x) = rb_to_float(x);}} while(0) #define Need_Float2(x,y) do {\ Need_Float(x);\ Need_Float(y);\