1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
ocean 2005-10-30 17:37:31 +00:00
parent 673dcd5ae2
commit 73ded59d0a
2 changed files with 9 additions and 4 deletions

View file

@ -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> Sat Oct 29 01:58:25 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/etc/etc.c: document update from mathew <meta@pobox.com>. * ext/etc/etc.c: document update from mathew <meta@pobox.com>.

View file

@ -40,10 +40,10 @@ class TestFloat < Test::Unit::TestCase
end end
def test_precision def test_precision
#s = "3.7517675036461267e+17" u = 3.7517675036461267e+17
#assert(s == sprintf("%.16e", s.to_f)) v = sprintf("%.16e", u).to_f
f = 3.7517675036461267e+17 assert_in_delta(u, v, u.abs * Float::EPSILON)
assert_equal(f, sprintf("%.16e", f).to_f) assert_in_delta(u, v, v.abs * Float::EPSILON)
end end
def test_symmetry_bignum # [ruby-bugs-ja:118] def test_symmetry_bignum # [ruby-bugs-ja:118]