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 (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/branches/ruby_1_8@23667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-06-11 08:49:37 +00:00
parent 1e7898d76a
commit bbfe73888a
3 changed files with 21 additions and 11 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:05:00 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/bigdecimal/bigdecimal.c (VpCtoV): big number should result

View file

@ -647,10 +647,10 @@ BigDecimal_coerce(VALUE self, VALUE other)
VALUE obj;
Real *b;
if(TYPE(other) == T_FLOAT) {
obj = rb_assoc_new(other, BigDecimal_to_f(self));
obj = rb_assoc_new(other, BigDecimal_to_f(self));
} else {
GUARD_OBJ(b,GetVpValue(other,1));
obj = rb_assoc_new(b->obj, self);
GUARD_OBJ(b,GetVpValue(other,1));
obj = rb_assoc_new(b->obj, self);
}
return obj;
}
@ -1945,7 +1945,7 @@ Init_bigdecimal(void)
rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2);
rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2);
rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2);
rb_define_method(rb_cBigDecimal, "div",BigDecimal_div2, -1);
rb_define_method(rb_cBigDecimal, "div", BigDecimal_div2, -1);
rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0);
rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1);
rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0);
@ -2005,7 +2005,9 @@ Init_bigdecimal(void)
*/
#ifdef _DEBUG
static int gfDebug = 1; /* Debug switch */
#if 0
static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
#endif
#endif /* _DEBUG */
static U_LONG gnPrecLimit = 0; /* Global upper limit of the precision newly allocated */
@ -2458,8 +2460,8 @@ VpInit(U_LONG BaseVal)
printf(" BASE = %lu\n", BASE);
printf(" HALF_BASE = %lu\n", HALF_BASE);
printf(" BASE1 = %lu\n", BASE1);
printf(" BASE_FIG = %lu\n", BASE_FIG);
printf(" DBLE_FIG = %lu\n", DBLE_FIG);
printf(" BASE_FIG = %d\n", BASE_FIG);
printf(" DBLE_FIG = %d\n", DBLE_FIG);
}
#endif /* _DEBUG */
@ -3609,7 +3611,7 @@ Exit:
* a ... VP variable to be printed
*/
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 n, m, e, nn;
@ -3653,7 +3655,7 @@ VPrint(FILE *fp, char *cntl_chr, Real *a)
while(m) {
nn = e / m;
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 */
/* be printed. */
++nd;
@ -3775,7 +3777,7 @@ VpSzMantissa(Real *a,char *psz)
while(m) {
nn = e / m;
if((!ZeroSup) || nn) {
sprintf(psz, "%lu", nn); /* The reading zero(s) */
sprintf(psz, "%lu", nn); /* The leading zero(s) */
psz += strlen(psz);
/* as 0.00xx will be ignored. */
ZeroSup = 0; /* Set to print succeeding zeros */
@ -4130,7 +4132,7 @@ Exit:
if(gfDebug) {
VPrint(stdout, " VpVtoD: m=%\n", m);
printf(" d=%e * 10 **%ld\n", *d, *e);
printf(" DBLE_FIG = %ld\n", DBLE_FIG);
printf(" DBLE_FIG = %d\n", DBLE_FIG);
}
#endif /*_DEBUG */
return f;

View file

@ -211,7 +211,7 @@ VP_EXPORT Real *VpOne(void);
#define VpExponent(a) (a->exponent)
#ifdef _DEBUG
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 */
#if defined(__cplusplus)