FIX Display.print2 bug for value==10 (resulted in "0")

This commit is contained in:
Patrick Haßel 2025-01-10 18:25:38 +01:00
parent 71b99cca5e
commit a0b3ace3e6

View File

@ -119,7 +119,7 @@ public:
const int value = (int) round(abs(valueDbl));
const bool negative = valueDbl < 0;
const int digitCount = (int) max(1.0, ceil(log10(value))); // log10 is -inf for value==0, hence the max(1.0, ...)
const int digitCount = (int) max(1.0, floor(log10(value)) + 1); // log10 is -inf for value==0, hence the max(1.0, ...)
if (align == RIGHT) {
x -= ((negative ? 1 : 0) + digitCount) * (DISPLAY_CHAR_WIDTH + 1) - 1;
}