ruby-changes:9294
From: yugui <ko1@a...>
Date: Wed, 17 Dec 2008 15:19:36 +0900 (JST)
Subject: [ruby-changes:9294] Ruby:r20832 (ruby_1_9_1): merges r20797 from trunk into ruby_1_9_1.
yugui 2008-12-17 15:18:38 +0900 (Wed, 17 Dec 2008) New Revision: 20832 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20832 Log: merges r20797 from trunk into ruby_1_9_1. * ext/bigdecimal/bigdecimal.c (VpToString): reverted modification (that caused a bug) in r20359. [ruby-dev:37370] * ext/bigdecimal/bigdecimal.c (BigDecimal_limit): comment update. [ruby-dev:37465] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/ext/bigdecimal/bigdecimal.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20831) +++ ruby_1_9_1/ChangeLog (revision 20832) @@ -1,3 +1,11 @@ +Tue Dec 16 21:59:02 2008 Yukihiro Matsumoto <matz@r...> + + * ext/bigdecimal/bigdecimal.c (VpToString): reverted modification + (that caused a bug) in r20359. [ruby-dev:37370] + + * ext/bigdecimal/bigdecimal.c (BigDecimal_limit): comment update. + [ruby-dev:37465] + Tue Dec 16 22:42:16 2008 NAKAMURA Usaku <usa@r...> * lib/test/unit.rb (Test::Unit.setup_argv): sorry, fixed wrong commit. Index: ruby_1_9_1/ext/bigdecimal/bigdecimal.c =================================================================== --- ruby_1_9_1/ext/bigdecimal/bigdecimal.c (revision 20831) +++ ruby_1_9_1/ext/bigdecimal/bigdecimal.c (revision 20832) @@ -1797,7 +1797,7 @@ * * A limit of 0, the default, means no upper limit. * - * The limit specified by this method takes priority over any limit + * The limit specified by this method takes less priority over any limit * specified to instance methods such as ceil, floor, truncate, or round. */ static VALUE @@ -3858,7 +3858,7 @@ /* fPlus =0:default, =1: set ' ' before digits , =2:set '+' before digits. */ { U_LONG i, ZeroSup; - U_LONG n, e; + U_LONG n, m, e, nn; char *pszSav = psz; S_LONG ex; @@ -3874,12 +3874,18 @@ *psz++ = '.'; n = a->Prec; for(i=0;i < n;++i) { + m = BASE1; e = a->frac[i]; - if((!ZeroSup) || e) { - sprintf(psz, "%lu", e); /* The reading zero(s) */ - psz += strlen(psz); - /* as 0.00xx will be ignored. */ - ZeroSup = 0; /* Set to print succeeding zeros */ + while(m) { + nn = e / m; + if((!ZeroSup) || nn) { + sprintf(psz, "%lu", nn); /* The reading zero(s) */ + psz += strlen(psz); + /* as 0.00xx will be ignored. */ + ZeroSup = 0; /* Set to print succeeding zeros */ + } + e = e - nn * m; + m /= 10; } } ex =(a->exponent) * BASE_FIG; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/