mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 19:44:01 +02:00
sprintf.c: exact number
* sprintf.c (rb_str_format): format exact number more exactly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ed11f4b4b5
commit
1301d1f5bc
3 changed files with 18 additions and 3 deletions
|
@ -149,6 +149,11 @@ class TestSprintf < Test::Unit::TestCase
|
|||
assert_equal(" Inf", sprintf("% e", inf), '[ruby-dev:34002]')
|
||||
end
|
||||
|
||||
def test_bignum
|
||||
assert_match(/\A10{120}\.0+\z/, sprintf("%f", 100**60))
|
||||
assert_match(/\A10{180}\.0+\z/, sprintf("%f", 1000**60))
|
||||
end
|
||||
|
||||
def test_rational
|
||||
assert_match(/\A0\.10+\z/, sprintf("%.60f", 0.1r))
|
||||
assert_match(/\A0\.010+\z/, sprintf("%.60f", 0.01r))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue