* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.

* ext/bigdecimal/bigdecimal.c (VpInit): fixed format modifiers.

* ext/bigdecimal/bigdecimal.c (VPrint): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-06-11 08:49:37 +00:00
parent 831e03ebd6
commit 610c0568c4
3 changed files with 22 additions and 12 deletions

View File

@ -1,3 +1,11 @@
Thu Jun 11 17:49:33 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (gfCheckVal): never used.
* ext/bigdecimal/bigdecimal.c (VpInit): fixed format modifiers.
* ext/bigdecimal/bigdecimal.c (VPrint): constified.
Thu Jun 11 15:27:17 2009 Yukihiro Matsumoto <matz@ruby-lang.org> Thu Jun 11 15:27:17 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/prime.rb: documentation typo fixed. a patch from okkez. * lib/prime.rb: documentation typo fixed. a patch from okkez.

View File

@ -2054,7 +2054,9 @@ Init_bigdecimal(void)
*/ */
#ifdef _DEBUG #ifdef _DEBUG
static int gfDebug = 1; /* Debug switch */ static int gfDebug = 1; /* Debug switch */
#if 0
static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */ static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
#endif
#endif /* _DEBUG */ #endif /* _DEBUG */
static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */ static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */
@ -2507,8 +2509,8 @@ VpInit(U_LONG BaseVal)
printf(" BASE = %lu\n", BASE); printf(" BASE = %lu\n", BASE);
printf(" HALF_BASE = %lu\n", HALF_BASE); printf(" HALF_BASE = %lu\n", HALF_BASE);
printf(" BASE1 = %lu\n", BASE1); printf(" BASE1 = %lu\n", BASE1);
printf(" BASE_FIG = %lu\n", BASE_FIG); printf(" BASE_FIG = %d\n", BASE_FIG);
printf(" DBLE_FIG = %lu\n", DBLE_FIG); printf(" DBLE_FIG = %d\n", DBLE_FIG);
} }
#endif /* _DEBUG */ #endif /* _DEBUG */
@ -3658,7 +3660,7 @@ Exit:
* a ... VP variable to be printed * a ... VP variable to be printed
*/ */
VP_EXPORT int VP_EXPORT int
VPrint(FILE *fp, char *cntl_chr, Real *a) VPrint(FILE *fp, const char *cntl_chr, Real *a)
{ {
U_LONG i, j, nc, nd, ZeroSup; U_LONG i, j, nc, nd, ZeroSup;
U_LONG n, m, e, nn; U_LONG n, m, e, nn;
@ -3702,7 +3704,7 @@ VPrint(FILE *fp, char *cntl_chr, Real *a)
while(m) { while(m) {
nn = e / m; nn = e / m;
if((!ZeroSup) || nn) { if((!ZeroSup) || nn) {
nc += fprintf(fp, "%lu", nn); /* The reading zero(s) */ nc += fprintf(fp, "%lu", nn); /* The leading zero(s) */
/* as 0.00xx will not */ /* as 0.00xx will not */
/* be printed. */ /* be printed. */
++nd; ++nd;
@ -3824,7 +3826,7 @@ VpSzMantissa(Real *a,char *psz)
while(m) { while(m) {
nn = e / m; nn = e / m;
if((!ZeroSup) || nn) { if((!ZeroSup) || nn) {
sprintf(psz, "%lu", nn); /* The reading zero(s) */ sprintf(psz, "%lu", nn); /* The leading zero(s) */
psz += strlen(psz); psz += strlen(psz);
/* as 0.00xx will be ignored. */ /* as 0.00xx will be ignored. */
ZeroSup = 0; /* Set to print succeeding zeros */ ZeroSup = 0; /* Set to print succeeding zeros */
@ -4179,7 +4181,7 @@ Exit:
if(gfDebug) { if(gfDebug) {
VPrint(stdout, " VpVtoD: m=%\n", m); VPrint(stdout, " VpVtoD: m=%\n", m);
printf(" d=%e * 10 **%ld\n", *d, *e); printf(" d=%e * 10 **%ld\n", *d, *e);
printf(" DBLE_FIG = %ld\n", DBLE_FIG); printf(" DBLE_FIG = %d\n", DBLE_FIG);
} }
#endif /*_DEBUG */ #endif /*_DEBUG */
return f; return f;
@ -4447,11 +4449,11 @@ VpMidRound(Real *y, int f, int nf)
nf += y->exponent*((int)BASE_FIG); nf += y->exponent*((int)BASE_FIG);
exptoadd=0; exptoadd=0;
if (nf < 0) { if (nf < 0) {
/* rounding position too left(large). */ /* rounding position too left(large). */
if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) { if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) {
VpSetZero(y,VpGetSign(y)); /* truncate everything */ VpSetZero(y,VpGetSign(y)); /* truncate everything */
return 0; return 0;
} }
exptoadd = -nf; exptoadd = -nf;
nf = 0; nf = 0;
} }

View File

@ -211,7 +211,7 @@ VP_EXPORT Real *VpOne(void);
#define VpExponent(a) (a->exponent) #define VpExponent(a) (a->exponent)
#ifdef _DEBUG #ifdef _DEBUG
int VpVarCheck(Real * v); int VpVarCheck(Real * v);
VP_EXPORT int VPrint(FILE *fp,char *cntl_chr,Real *a); VP_EXPORT int VPrint(FILE *fp,const char *cntl_chr,Real *a);
#endif /* _DEBUG */ #endif /* _DEBUG */
#if defined(__cplusplus) #if defined(__cplusplus)