Thread: [PATCH] FIx alloc_var() ndigits thinko

[PATCH] FIx alloc_var() ndigits thinko

From
"Joel Jacobson"
Date:
Hi,

I came across another harmless thinko in numeric.c.

It is harmless since 20/DEC_DIGITS and 40/DEC_DIGITS happens to be exactly 5 and 10 since DEC_DIGITS == 4,
but should be fixed anyway for correctness IMO.

-       alloc_var(var, 20 / DEC_DIGITS);
+       alloc_var(var, (20 + DEC_DIGITS - 1) / DEC_DIGITS);

-       alloc_var(var, 40 / DEC_DIGITS);
+       alloc_var(var, (40 + DEC_DIGITS - 1) / DEC_DIGITS);

/Joel

Attachment