diff --git a/core/float/round_spec.rb b/core/float/round_spec.rb index 46d23b36d0..56668d5856 100644 --- a/core/float/round_spec.rb +++ b/core/float/round_spec.rb @@ -84,4 +84,18 @@ -2.5e200.round(-200).should eql( -3 * 10 ** 200 ) -2.4e200.round(-200).should eql( -2 * 10 ** 200 ) end + + ruby_version_is "2.4" do + it "returns different rounded values depending on the half option" do + 2.5.round(half: :up).should eql(3) + 2.5.round(half: :down).should eql(2) + 2.5.round(half: :even).should eql(2) + 3.5.round(half: :up).should eql(4) + 3.5.round(half: :down).should eql(3) + 3.5.round(half: :even).should eql(4) + (-2.5).round(half: :up).should eql(-3) + (-2.5).round(half: :down).should eql(-2) + (-2.5).round(half: :even).should eql(-2) + end + end end