Bug for print float
Opened this issue · 0 comments
eti57 commented
Thanks for this nice librarie
But there is an error in line 312 et 325.
",10)" is missing two times.
(when used with arduino and SH1106LIB)
This code work better :
// Extract the integer part of the number and print it
unsigned long int_part = (unsigned long)number;
double remainder = number - (double)int_part;
print(int_part,10);
// Print the decimal point, but only if there are digits beyond
if (digits > 0) {
print('.');
}
// Extract digits from the remainder one at a time
while (digits-- > 0)
{
remainder *= 10.0;
unsigned int toPrint = (unsigned int)(remainder);
print(toPrint,10);
remainder -= toPrint;
}
}
remainder *= 10.0;
unsigned int toPrint = (unsigned int)(remainder);
print(toPrint,**10)**;
remainder -= toPrint;
}
}