summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 15:51:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-23 15:51:31 +0000
commit0b58675868978bbde67c25eec1223b8de05aba34 (patch)
tree705c0f51b0940e2b3277a8c60b98f5e7bd21d472 /math.c
parente69f2129339e9b13dbce30c0bcfd139b696bf2fe (diff)
* math.c (Need_Float): call rb_to_float() only when it is really
needed. small performance improvement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'math.c')
-rw-r--r--math.c2
1 files changed, 1 insertions, 1 deletions
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);\