File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 30
30
12.345678 . round ( 3.999 ) . should == 12.346
31
31
end
32
32
33
+ it "correctly rounds exact floats with a numerous digits in a fraction part" do
34
+ 0.8241000000000004 . round ( 10 ) . should == 0.8241
35
+ 0.8241000000000002 . round ( 10 ) . should == 0.8241
36
+ end
37
+
33
38
it "returns zero when passed a negative argument with magnitude greater than magnitude of the whole number portion of the Float" do
34
39
0.8346268 . round ( -1 ) . should eql ( 0 )
35
40
end
68
73
0.42 . round ( 2.0 **30 ) . should == 0.42
69
74
end
70
75
76
+ it "returns rounded values for not so big argument" do
77
+ 0.42 . round ( 2.0 **23 ) . should == 0.42
78
+ end
79
+
71
80
it "returns big values rounded to nearest" do
72
81
+2.5e20 . round ( -20 ) . should eql ( +3 * 10 ** 20 )
73
82
-2.5e20 . round ( -20 ) . should eql ( -3 * 10 ** 20 )
You can’t perform that action at this time.
0 commit comments