diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 04:32:57 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-01 04:32:57 +0000 |
commit | 12b2e16e21bbd7f0b6fd12c7e21cba4d42e284ad (patch) | |
tree | 20346cc6c455bba7684139a3c2af88806a9ba7b4 /test/ruby | |
parent | 4d399f12d4354c17bbb1ea2b12de4c11c6ac03ff (diff) | |
download | ruby-12b2e16e21bbd7f0b6fd12c7e21cba4d42e284ad.tar.gz |
* sprintf.c (rb_str_format): support %a format. [ruby-dev:40650]
* missing/vsnprintf.c (BSD_vfprintf): ditto.
* missing/vsnprintf.c (cvt): ditto.
* util.c (BSD__hdtoa): added. This is 2-clause BSDL licensed
by David Schultz and from FreeBSD.
* LEGAL: add about hdtoa() in util.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_sprintf.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 15424d98ac..f8dbbd511e 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -191,6 +191,19 @@ class TestSprintf < Test::Unit::TestCase assert_equal(" Inf", sprintf("% 0e", 1.0/0.0), "moved from btest/knownbug") end + def test_float_hex + assert_equal("-0x0p+0", sprintf("%a", -0.0)) + assert_equal("0x0p+0", sprintf("%a", 0.0)) + assert_equal("0x1p-1", sprintf("%a", 0.5)) + assert_equal("0x1p+0", sprintf("%a", 1.0)) + assert_equal("0x1p+1", sprintf("%a", 2.0)) + assert_equal("0x1.193ea7aad030ap+0", sprintf("%a", Math.log(3))) + assert_equal("0X1.193EA7AAD030AP+0", sprintf("%A", Math.log(3))) + assert_equal("0x1p+10", sprintf("%a", 1024)) + assert_equal("0x1.23456p+789", sprintf("%a", 3.704450999893983e+237)) + assert_equal("0x1p-1074", sprintf("%a", 4.9e-324)) + end + BSIZ = 120 def test_skip |