summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-12 03:26:39 (GMT)
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-12 03:26:39 (GMT)
commit00b8b11858785439785c0f6805ea4b6910070020 (patch)
tree2bdd01ea10b74ce28396a3caa0b69f1ede365ac4 /vm_insnhelper.c
parent21e1260fb94f7d339ee60eedbba1975113ade7f1 (diff)
vm_insnhelper.c: avoid division by zero
same as r65642. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 84ed116..05a5289 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -3450,7 +3450,7 @@ vm_opt_div(VALUE recv, VALUE obj)
}
else if (FLONUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
- return DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
+ return rb_flo_div_flo(recv, obj);
}
else if (SPECIAL_CONST_P(recv) || SPECIAL_CONST_P(obj)) {
return Qundef;
@@ -3458,7 +3458,7 @@ vm_opt_div(VALUE recv, VALUE obj)
else if (RBASIC_CLASS(recv) == rb_cFloat &&
RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
- return DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
+ return rb_flo_div_flo(recv, obj);
}
else {
return Qundef;