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:
parent
673dcd5ae2
commit
73ded59d0a
2 changed files with 9 additions and 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>.
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue