diff options
Diffstat (limited to 'spec/ruby/core/float/round_spec.rb')
-rw-r--r-- | spec/ruby/core/float/round_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/ruby/core/float/round_spec.rb b/spec/ruby/core/float/round_spec.rb index 46d23b36d0..56668d5856 100644 --- a/spec/ruby/core/float/round_spec.rb +++ b/spec/ruby/core/float/round_spec.rb @@ -84,4 +84,18 @@ describe "Float#round" do -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 |