summaryrefslogtreecommitdiffhomepage
path: root/test/t/float.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/float.rb')
-rw-r--r--test/t/float.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/t/float.rb b/test/t/float.rb
index a76dbf39b..e4c25b34e 100644
--- a/test/t/float.rb
+++ b/test/t/float.rb
@@ -303,4 +303,16 @@ assert('Float#eql?') do
assert_not_operator(5.0, :eql?, "5.0")
end
+assert('Float#abs') do
+ f = 1.0
+ assert_equal(1.0, f.abs)
+ f = -1.0
+ assert_equal(1.0, f.abs)
+ f = 0.0
+ assert_equal(0.0, f.abs)
+ # abs(negative zero) should be positive zero
+ f = -0.0
+ assert_equal(0.0, f.abs)
+end
+
end # const_defined?(:Float)