summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-03-04 10:22:17 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-03-07 12:14:48 +0900
commit8841f885bde7bbe571d2043830799059870dc70c (patch)
treea6cac4130484ba1c7b55434710c249b99210d50d /test/ruby
parent6bad47ac6d62b54fe30e3f161c2a9d8f5fa4800c (diff)
[Bug #21163] Fix hexadecimal float conversion
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12878
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_float.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb
index f2c56d1b41..b865d339a9 100644
--- a/test/ruby/test_float.rb
+++ b/test/ruby/test_float.rb
@@ -838,6 +838,10 @@ class TestFloat < Test::Unit::TestCase
assert_equal(15, Float('0xf.p0'))
assert_equal(15.9375, Float('0xf.f'))
assert_raise(ArgumentError) { Float('0xf.fp') }
+ assert_equal(0x10a, Float("0x1_0a"))
+ assert_equal(1.625, Float("0x1.a_0"))
+ assert_equal(3.25, Float("0x1.ap0_1"))
+ assert_raise(ArgumentError) { Float("0x1.ap0a") }
begin
verbose_bak, $VERBOSE = $VERBOSE, nil
assert_equal(Float::INFINITY, Float('0xf.fp1000000000000000'))