Off by one error when printing exact poweres of ten

This commit is contained in:
andy 2005-03-12 15:49:53 +00:00
parent 8ac27cc798
commit 26e70664d6

View File

@ -219,7 +219,7 @@ static int decprint(int val, unsigned char* s)
{ {
int p=1, i=0; int p=1, i=0;
if(val == 0) { *s = '0'; return 1; } if(val == 0) { *s = '0'; return 1; }
while(p < 1000000000 && p*10 < val) p *= 10; while(p < 999999999 && p*10 < val) p *= 10;
while(p > 0) { while(p > 0) {
int count = 0; int count = 0;
while(val >= p) { val -= p; count++; } while(val >= p) { val -= p; count++; }