Skip to content

Commit b07aebc

Browse files
committed
Remove debug print
VPrint is very useful for debugging. But debug prints remained in source code are useless because: - Too many debug prints for debugging. - Information is missing. While debugging a specific case, I need to add more printf and VPrints. - It's just a noise finding VPrint by grep added in a specific print-debugging.
1 parent 0daef5b commit b07aebc

1 file changed

Lines changed: 0 additions & 125 deletions

File tree

ext/bigdecimal/bigdecimal.c

Lines changed: 0 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,9 +2586,6 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
25862586
GUARD_OBJ(c, NewZeroWrapLimited(1, mx));
25872587
VpSetPrecLimit(pl);
25882588
VpActiveRound(c.real, a.real, VP_ROUND_FLOOR, iLoc);
2589-
#ifdef BIGDECIMAL_DEBUG
2590-
VPrint(stderr, "floor: c=%\n", c.real);
2591-
#endif
25922589
if (argc == 0) {
25932590
return BigDecimal_to_i(CheckGetValue(c));
25942591
}
@@ -4631,9 +4628,6 @@ Init_bigdecimal(void)
46314628
*/
46324629
#ifdef BIGDECIMAL_DEBUG
46334630
static int gfDebug = 1; /* Debug switch */
4634-
#if 0
4635-
static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
4636-
#endif
46374631
#endif /* BIGDECIMAL_DEBUG */
46384632

46394633
static Real *VpConstOne; /* constant 1.0 */
@@ -5068,17 +5062,6 @@ VpInit(DECDIG BaseVal)
50685062
gnAlloc = 0;
50695063
#endif /* BIGDECIMAL_DEBUG */
50705064

5071-
#ifdef BIGDECIMAL_DEBUG
5072-
if (gfDebug) {
5073-
printf("VpInit: BaseVal = %"PRIuDECDIG"\n", BaseVal);
5074-
printf("\tBASE = %"PRIuDECDIG"\n", BASE);
5075-
printf("\tHALF_BASE = %"PRIuDECDIG"\n", HALF_BASE);
5076-
printf("\tBASE1 = %"PRIuDECDIG"\n", BASE1);
5077-
printf("\tBASE_FIG = %u\n", BASE_FIG);
5078-
printf("\tBIGDECIMAL_DOUBLE_FIGURES = %d\n", BIGDECIMAL_DOUBLE_FIGURES);
5079-
}
5080-
#endif /* BIGDECIMAL_DEBUG */
5081-
50825065
return BIGDECIMAL_DOUBLE_FIGURES;
50835066
}
50845067

@@ -5487,14 +5470,6 @@ VpAddSub(Real *c, Real *a, Real *b, int operation)
54875470
size_t n, na, nb, i;
54885471
DECDIG mrv;
54895472

5490-
#ifdef BIGDECIMAL_DEBUG
5491-
if (gfDebug) {
5492-
VPrint(stdout, "VpAddSub(enter) a=% \n", a);
5493-
VPrint(stdout, " b=% \n", b);
5494-
printf(" operation=%d\n", operation);
5495-
}
5496-
#endif /* BIGDECIMAL_DEBUG */
5497-
54985473
if (!VpIsDefOP(c, a, b, (operation > 0) ? OP_SW_ADD : OP_SW_SUB)) return 0; /* No significant digits */
54995474

55005475
/* check if a or b is zero */
@@ -5598,14 +5573,6 @@ VpAddSub(Real *c, Real *a, Real *b, int operation)
55985573
VpInternalRound(c, 0, (c->Prec > 0) ? c->frac[c->Prec-1] : 0, mrv);
55995574
}
56005575

5601-
#ifdef BIGDECIMAL_DEBUG
5602-
if (gfDebug) {
5603-
VPrint(stdout, "VpAddSub(result) c=% \n", c);
5604-
VPrint(stdout, " a=% \n", a);
5605-
VPrint(stdout, " b=% \n", b);
5606-
printf(" operation=%d\n", operation);
5607-
}
5608-
#endif /* BIGDECIMAL_DEBUG */
56095576
return c->Prec * BASE_FIG;
56105577
}
56115578

@@ -5626,13 +5593,6 @@ VpAddAbs(Real *a, Real *b, Real *c)
56265593
size_t c_pos;
56275594
DECDIG av, bv, carry, mrv;
56285595

5629-
#ifdef BIGDECIMAL_DEBUG
5630-
if (gfDebug) {
5631-
VPrint(stdout, "VpAddAbs called: a = %\n", a);
5632-
VPrint(stdout, " b = %\n", b);
5633-
}
5634-
#endif /* BIGDECIMAL_DEBUG */
5635-
56365596
word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv);
56375597
a_pos = ap;
56385598
b_pos = bp;
@@ -5698,11 +5658,6 @@ VpAddAbs(Real *a, Real *b, Real *c)
56985658

56995659
Exit:
57005660

5701-
#ifdef BIGDECIMAL_DEBUG
5702-
if (gfDebug) {
5703-
VPrint(stdout, "VpAddAbs exit: c=% \n", c);
5704-
}
5705-
#endif /* BIGDECIMAL_DEBUG */
57065661
return mrv;
57075662
}
57085663

@@ -5721,13 +5676,6 @@ VpSubAbs(Real *a, Real *b, Real *c)
57215676
size_t c_pos;
57225677
DECDIG av, bv, borrow, mrv;
57235678

5724-
#ifdef BIGDECIMAL_DEBUG
5725-
if (gfDebug) {
5726-
VPrint(stdout, "VpSubAbs called: a = %\n", a);
5727-
VPrint(stdout, " b = %\n", b);
5728-
}
5729-
#endif /* BIGDECIMAL_DEBUG */
5730-
57315679
word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv);
57325680
a_pos = ap;
57335681
b_pos = bp;
@@ -5803,11 +5751,6 @@ VpSubAbs(Real *a, Real *b, Real *c)
58035751
mrv = 0;
58045752

58055753
Exit:
5806-
#ifdef BIGDECIMAL_DEBUG
5807-
if (gfDebug) {
5808-
VPrint(stdout, "VpSubAbs exit: c=% \n", c);
5809-
}
5810-
#endif /* BIGDECIMAL_DEBUG */
58115754
return mrv;
58125755
}
58135756

@@ -5945,13 +5888,6 @@ VpMult(Real *c, Real *a, Real *b)
59455888
DECDIG_DBL s;
59465889
Real *w;
59475890

5948-
#ifdef BIGDECIMAL_DEBUG
5949-
if (gfDebug) {
5950-
VPrint(stdout, "VpMult(Enter): a=% \n", a);
5951-
VPrint(stdout, " b=% \n", b);
5952-
}
5953-
#endif /* BIGDECIMAL_DEBUG */
5954-
59555891
if (!VpIsDefOP(c, a, b, OP_SW_MULT)) return 0; /* No significant digit */
59565892

59575893
if (VpIsZero(a) || VpIsZero(b)) {
@@ -6051,13 +5987,6 @@ VpMult(Real *c, Real *a, Real *b)
60515987
}
60525988

60535989
Exit:
6054-
#ifdef BIGDECIMAL_DEBUG
6055-
if (gfDebug) {
6056-
VPrint(stdout, "VpMult(c=a*b): c=% \n", c);
6057-
VPrint(stdout, " a=% \n", a);
6058-
VPrint(stdout, " b=% \n", b);
6059-
}
6060-
#endif /*BIGDECIMAL_DEBUG */
60615990
return c->Prec*BASE_FIG;
60625991
}
60635992

@@ -6074,13 +6003,6 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
60746003
DECDIG borrow, borrow1, borrow2;
60756004
DECDIG_DBL qb;
60766005

6077-
#ifdef BIGDECIMAL_DEBUG
6078-
if (gfDebug) {
6079-
VPrint(stdout, " VpDivd(c=a/b) a=% \n", a);
6080-
VPrint(stdout, " b=% \n", b);
6081-
}
6082-
#endif /*BIGDECIMAL_DEBUG */
6083-
60846006
VpSetNaN(r);
60856007
if (!VpIsDefOP(c, a, b, OP_SW_DIV)) goto Exit;
60866008
if (VpIsZero(a) && VpIsZero(b)) {
@@ -6253,24 +6175,9 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
62536175
goto Exit;
62546176

62556177
space_error:
6256-
#ifdef BIGDECIMAL_DEBUG
6257-
if (gfDebug) {
6258-
printf(" word_a=%"PRIuSIZE"\n", word_a);
6259-
printf(" word_b=%"PRIuSIZE"\n", word_b);
6260-
printf(" word_c=%"PRIuSIZE"\n", word_c);
6261-
printf(" word_r=%"PRIuSIZE"\n", word_r);
6262-
printf(" ind_r =%"PRIuSIZE"\n", ind_r);
6263-
}
6264-
#endif /* BIGDECIMAL_DEBUG */
62656178
rb_bug("ERROR(VpDivd): space for remainder too small.");
62666179

62676180
Exit:
6268-
#ifdef BIGDECIMAL_DEBUG
6269-
if (gfDebug) {
6270-
VPrint(stdout, " VpDivd(c=a/b), c=% \n", c);
6271-
VPrint(stdout, " r=% \n", r);
6272-
}
6273-
#endif /* BIGDECIMAL_DEBUG */
62746181
return c->Prec * BASE_FIG;
62756182
}
62766183

@@ -6393,13 +6300,6 @@ VpComp(Real *a, Real *b)
63936300
if (val > 1) val = 1;
63946301
else if (val < -1) val = -1;
63956302

6396-
#ifdef BIGDECIMAL_DEBUG
6397-
if (gfDebug) {
6398-
VPrint(stdout, " VpComp a=%\n", a);
6399-
VPrint(stdout, " b=%\n", b);
6400-
printf(" ans=%d\n", val);
6401-
}
6402-
#endif /* BIGDECIMAL_DEBUG */
64036303
return (int)val;
64046304
}
64056305

@@ -7012,13 +6912,6 @@ VpVtoD(double *d, SIGNED_VALUE *e, Real *m)
70126912
*d *= VpGetSign(m);
70136913

70146914
Exit:
7015-
#ifdef BIGDECIMAL_DEBUG
7016-
if (gfDebug) {
7017-
VPrint(stdout, " VpVtoD: m=%\n", m);
7018-
printf(" d=%e * 10 **%ld\n", *d, *e);
7019-
printf(" BIGDECIMAL_DOUBLE_FIGURES = %d\n", BIGDECIMAL_DOUBLE_FIGURES);
7020-
}
7021-
#endif /*BIGDECIMAL_DEBUG */
70226915
return f;
70236916
}
70246917

@@ -7081,12 +6974,6 @@ VpDtoV(Real *m, double d)
70816974
(DECDIG)(val*(double)BASE));
70826975

70836976
Exit:
7084-
#ifdef BIGDECIMAL_DEBUG
7085-
if (gfDebug) {
7086-
printf("VpDtoV d=%30.30e\n", d);
7087-
VPrint(stdout, " m=%\n", m);
7088-
}
7089-
#endif /* BIGDECIMAL_DEBUG */
70906977
return;
70916978
}
70926979

@@ -7144,12 +7031,6 @@ VpItoV(Real *m, SIGNED_VALUE ival)
71447031
VpNmlz(m);
71457032

71467033
Exit:
7147-
#ifdef BIGDECIMAL_DEBUG
7148-
if (gfDebug) {
7149-
printf(" VpItoV i=%d\n", ival);
7150-
VPrint(stdout, " m=%\n", m);
7151-
}
7152-
#endif /* BIGDECIMAL_DEBUG */
71537034
return;
71547035
}
71557036
#endif
@@ -7573,12 +7454,6 @@ VpFrac(Real *y, Real *x)
75737454
VpNmlz(y);
75747455

75757456
Exit:
7576-
#ifdef BIGDECIMAL_DEBUG
7577-
if (gfDebug) {
7578-
VPrint(stdout, "VpFrac y=%\n", y);
7579-
VPrint(stdout, " x=%\n", x);
7580-
}
7581-
#endif /* BIGDECIMAL_DEBUG */
75827457
return;
75837458
}
75847459

0 commit comments

Comments
 (0)