fix(lua): playNumber with PREC2 - last decimal digit missing (#7364)

This commit is contained in:
Alex K
2026-08-31 10:25:44 +10:00
committed by GitHub
parent 3c4384c916
commit 3f7f6b6db0
19 changed files with 180 additions and 103 deletions
+10 -3
View File
@@ -76,13 +76,20 @@ I18N_PLAY_FUNCTION(ua, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
div_t qr = div((int)number, 10);
int8_t mode = MODE(att);
uint8_t rem2 = 0;
if (mode > 0 && att != UA_FEMALE_UNIT) {
if (mode == 2) {
number /= 10;
div_t qr2 = div((int)number, 10);
number = qr2.quot;
rem2 = qr2.rem;
}
if (qr.rem) {
qr = div((int)number, 10);
if (qr.rem || (mode == 2 && rem2)) {
PLAY_NUMBER(qr.quot, 0, 0);
PUSH_NUMBER_PROMPT(UA_PROMPT_POINT_BASE + qr.rem);
if (mode == 2 && rem2) {
PLAY_NUMBER(rem2, 0, 0);
}
number = -1;
}
else {
@@ -143,7 +150,7 @@ I18N_PLAY_FUNCTION(ua, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
}
if (unit) {
if (mode > 0 && qr.rem) // number with decimal point
if (mode > 0 && (qr.rem || rem2)) // number with decimal point
UA_PUSH_UNIT_PROMPT(unit, -1); // force 2 units form, if float value
else
UA_PUSH_UNIT_PROMPT(unit, tmp);