summaryrefslogtreecommitdiff
path: root/test/ruby/test_sprintf.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-09 01:57:49 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-09 01:57:49 +0000
commitc383fbf93f691f443eb16761351a6943bc29d3f9 (patch)
tree538fe8e31a85eb85a67ea1d1127dee2b9dc74fba /test/ruby/test_sprintf.rb
parentb3c7867df7cd186e73021f0ed9d17680999f190f (diff)
* util.c (ruby_strtod): this code uses FPU's rounding system.
But x86's FPU calculates double precision floating-point numbers in 80bit precision, so it fails to round the value. So ensure the value is assigned a variable. [ruby-dev:42551] see also [ruby-math:00802] http://www.shudo.net/java-grandprix99/strictfp/ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_sprintf.rb')
-rw-r--r--test/ruby/test_sprintf.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index b82cbc4b90..b918ceba72 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -190,6 +190,8 @@ class TestSprintf < Test::Unit::TestCase
sprintf("%20.0f", 36893488147419107329.0))
assert_equal(" Inf", sprintf("% 0e", 1.0/0.0), "moved from btest/knownbug")
assert_equal(" -0.", sprintf("%#10.0f", -0.5), "[ruby-dev:42552]")
+ assert_equal("0x1.p+2", sprintf('%.0a', Float('0x1.fp+1')), "[ruby-dev:42551]")
+ assert_equal("-0x1.0p+2", sprintf('%.0a', Float('-0x1.ffp+1')), "[ruby-dev:42551]")
end
def test_float_hex