summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index f924761001..e61f15d7c3 100644
--- a/numeric.c
+++ b/numeric.c
@@ -37,7 +37,9 @@ static VALUE
num_coerce(x, y)
VALUE x, y;
{
- return assoc_new(rb_Float(x),rb_Float(y));
+ if (CLASS_OF(x) == CLASS_OF(y))
+ return assoc_new(x, y);
+ return assoc_new(rb_Float(x), rb_Float(y));
}
coerce_body(x)