ruby-changes:17859
From: naruse <ko1@a...>
Date: Tue, 23 Nov 2010 01:06:53 +0900 (JST)
Subject: [ruby-changes:17859] Ruby:r29873 (trunk): * vsnprintf.c (BSD_vfprintf): don't output floating point
naruse 2010-11-23 01:06:38 +0900 (Tue, 23 Nov 2010) New Revision: 29873 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=29873 Log: * vsnprintf.c (BSD_vfprintf): don't output floating point when the precision is 0. [ruby-dev:42615] Modified files: trunk/ChangeLog trunk/test/ruby/test_sprintf.rb trunk/vsnprintf.c Index: ChangeLog =================================================================== --- ChangeLog (revision 29872) +++ ChangeLog (revision 29873) @@ -1,3 +1,8 @@ +Tue Nov 23 01:05:27 2010 NARUSE, Yui <naruse@r...> + + * vsnprintf.c (BSD_vfprintf): don't output floating point + when the precision is 0. [ruby-dev:42615] + Mon Nov 22 21:30:57 2010 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_inspect): fix for ascii-compatible external Index: vsnprintf.c =================================================================== --- vsnprintf.c (revision 29872) +++ vsnprintf.c (revision 29873) @@ -790,7 +790,7 @@ #ifdef FLOATING_POINT case 'a': case 'A': - if (prec >= 0) { + if (prec > 0) { flags |= ALT; prec++; } Index: test/ruby/test_sprintf.rb =================================================================== --- test/ruby/test_sprintf.rb (revision 29872) +++ test/ruby/test_sprintf.rb (revision 29873) @@ -190,7 +190,7 @@ 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("0x1p+2", sprintf('%.0a', Float('0x1.fp+1')), "[ruby-dev:42551]") assert_equal("-0x1.0p+2", sprintf('%.1a', Float('-0x1.ffp+1')), "[ruby-dev:42551]") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/