diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-17 16:21:45 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-17 16:21:45 +0000 |
commit | 9eb68d7c44a5c19396b3bc7123d3828bb7ae1b39 (patch) | |
tree | bc158c02daea97e3d58e70d5a010edbf6cb4ef21 /test/ruby/test_string.rb | |
parent | 5f0be51c21b3fe699c7fd6929e74ca9ade9a4339 (diff) | |
download | ruby-9eb68d7c44a5c19396b3bc7123d3828bb7ae1b39.tar.gz |
* util.c (ruby_strtod): Add support for Hexadecimal
floating-point expression [ruby-dev:40650] #2969
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 64205f6082..5d6d6d7ab8 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1385,6 +1385,15 @@ class TestString < Test::Unit::TestCase assert_equal(5.9742e24, S("5.9742e24").to_f) assert_equal(98.6, S("98.6 degrees").to_f) assert_equal(0.0, S("degrees 100.0").to_f) + assert_equal([ 0.0].pack('G'), [S(" 0.0").to_f].pack('G')) + assert_equal([-0.0].pack('G'), [S("-0.0").to_f].pack('G')) + assert_equal([ 0.0].pack('G'), [S(" 0x0p+0").to_f].pack('G')) + assert_equal([-0.0].pack('G'), [S("-0x0p+0").to_f].pack('G')) + assert_equal(1.0, S("0X1.P+0").to_f) + assert_equal(1024.0, S("0x1p+10").to_f) + assert_equal(0.0009765625, S("0x1p-10").to_f) + assert_equal(2.6881171418161356e+43, S("0x1.3494a9b171bf5p+144").to_f) + assert_equal(-3.720075976020836e-44, S("-0x1.a8c1f14e2af5dp-145").to_f) end def test_to_i |