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 | 73ded59d0ae61310670f40d58555b49d50f0c2f7 (patch) | |
tree | 3ec93e264b40b26267f165abb60a6ecfe02beb98 | |
parent | 673dcd5ae2cbe7c30dac31c92de3c3ab9eb8a567 (diff) |
* test/ruby/test_float.rb (test_precision): test by assert_in_delta.
[ruby-dev:27575]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_float.rb | 8 |
2 files changed, 9 insertions, 4 deletions
@@ -1,3 +1,8 @@ +Mon Oct 31 02:35:59 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp> + + * test/ruby/test_float.rb (test_precision): test by assert_in_delta. + [ruby-dev:27575] + Sat Oct 29 01:58:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org> * ext/etc/etc.c: document update from mathew <meta@pobox.com>. diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 741093fa61..fb180ff81b 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] |