1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-12-16 13:10:35 +00:00
parent d8d41b2380
commit 842be2d7cb
2 changed files with 21 additions and 7 deletions

View file

@ -2,6 +2,14 @@ Tue Dec 16 21:59:29 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/test/unit.rb (Test::Unit.setup_argv): ALT_SEPARATOR support. * lib/test/unit.rb (Test::Unit.setup_argv): ALT_SEPARATOR support.
Tue Dec 16 21:59:02 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 20:34:44 2008 Tanaka Akira <akr@fsij.org> Tue Dec 16 20:34:44 2008 Tanaka Akira <akr@fsij.org>
* ext/pty/pty.c (getDevice): add nomesg argument. * ext/pty/pty.c (getDevice): add nomesg argument.

View file

@ -1811,7 +1811,7 @@ BigDecimal_new(int argc, VALUE *argv, VALUE self)
* *
* A limit of 0, the default, means no upper limit. * 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. * specified to instance methods such as ceil, floor, truncate, or round.
*/ */
static VALUE static VALUE
@ -3872,7 +3872,7 @@ VpToString(Real *a,char *psz,int fFmt,int fPlus)
/* fPlus =0:default, =1: set ' ' before digits , =2:set '+' before digits. */ /* fPlus =0:default, =1: set ' ' before digits , =2:set '+' before digits. */
{ {
U_LONG i, ZeroSup; U_LONG i, ZeroSup;
U_LONG n, e; U_LONG n, m, e, nn;
char *pszSav = psz; char *pszSav = psz;
S_LONG ex; S_LONG ex;
@ -3888,12 +3888,18 @@ VpToString(Real *a,char *psz,int fFmt,int fPlus)
*psz++ = '.'; *psz++ = '.';
n = a->Prec; n = a->Prec;
for(i=0;i < n;++i) { for(i=0;i < n;++i) {
m = BASE1;
e = a->frac[i]; e = a->frac[i];
if((!ZeroSup) || e) { while(m) {
sprintf(psz, "%lu", e); /* The reading zero(s) */ nn = e / m;
psz += strlen(psz); if((!ZeroSup) || nn) {
/* as 0.00xx will be ignored. */ sprintf(psz, "%lu", nn); /* The reading zero(s) */
ZeroSup = 0; /* Set to print succeeding zeros */ 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; ex =(a->exponent) * BASE_FIG;