diff options
author | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-30 17:37:31 +0000 |
---|---|---|
committer | ocean <ocean@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-30 17:37:31 +0000 |
commit | cf2b91991c1df87161d52ac9d7fd5060514a2663 (patch) | |
tree | 3ec93e264b40b26267f165abb60a6ecfe02beb98 /test | |
parent | 7787035c3f44a0fe3ce413cc37fef14957e49e92 (diff) | |
download | ruby-cf2b91991c1df87161d52ac9d7fd5060514a2663.tar.gz ruby-cf2b91991c1df87161d52ac9d7fd5060514a2663.tar.xz ruby-cf2b91991c1df87161d52ac9d7fd5060514a2663.zip |
* test/ruby/test_float.rb (test_precision): test by assert_in_delta.
[ruby-dev:27575]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@9481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_float.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 741093fa6..fb180ff81 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -40,10 +40,10 @@ class TestFloat < Test::Unit::TestCase end def test_precision - #s = "3.7517675036461267e+17" - #assert(s == sprintf("%.16e", s.to_f)) - f = 3.7517675036461267e+17 - assert_equal(f, sprintf("%.16e", f).to_f) + u = 3.7517675036461267e+17 + v = sprintf("%.16e", u).to_f + assert_in_delta(u, v, u.abs * Float::EPSILON) + assert_in_delta(u, v, v.abs * Float::EPSILON) end def test_symmetry_bignum # [ruby-bugs-ja:118] |