Unverified Commit 19191a54 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4335 from shuujii/fix-Float-eql

Fix `Float#eql?`
parents 3f7cd468 a41b02ab
......@@ -369,7 +369,7 @@ flo_eql(mrb_state *mrb, mrb_value x)
mrb_get_args(mrb, "o", &y);
if (!mrb_float_p(y)) return mrb_false_value();
return mrb_bool_value(mrb_float(x) == (mrb_float)mrb_fixnum(y));
return mrb_bool_value(mrb_float(x) == mrb_float(y));
}
/* 15.2.9.3.7 */
......
......@@ -239,4 +239,10 @@ assert('Float#to_s') do
end
end
assert('Float#eql?') do
assert_true(5.0.eql?(5.0))
assert_false(5.0.eql?(5))
assert_false(5.0.eql?("5.0"))
end
end # const_defined?(:Float)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment