Skip to content

Commit 8c94132

Browse files
Bug 799268 - Cannot write a check over $1000
this is caused by d52d226 which caused log_val, pow_val, this_part to be kept as float instead of the original algorithm which required casting to int.
1 parent 0447e8d commit 8c94132

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

libgnucash/app-utils/gnc-ui-util.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,19 +1561,18 @@ integer_to_words(gint64 val)
15611561

15621562
while (val >= 1000)
15631563
{
1564-
auto log_val = log10(val) / 3 + FUDGE;
1565-
auto pow_val = exp(log_val * 3 * G_LN10) + FUDGE;
1566-
auto this_part = val / pow_val;
1564+
int log_val = log10(val) / 3 + FUDGE;
1565+
int pow_val = exp(log_val * 3 * G_LN10) + FUDGE;
1566+
int this_part = val / pow_val;
15671567
val -= this_part * pow_val;
15681568
auto tmp = integer_to_words(this_part);
1569-
g_string_append_printf(result, "%s %s ", tmp,
1570-
gettext(big_numbers[static_cast<int>(log_val)]));
1569+
g_string_append_printf(result, "%s %s ", tmp, gettext(big_numbers[log_val]));
15711570
g_free(tmp);
15721571
}
15731572

15741573
if (val >= 100)
15751574
{
1576-
auto this_part = val / 100;
1575+
int this_part = val / 100;
15771576
val -= this_part * 100;
15781577
g_string_append_printf(result, "%s %s ",
15791578
gettext(small_numbers[this_part]),
@@ -1582,15 +1581,15 @@ integer_to_words(gint64 val)
15821581

15831582
if (val > 20)
15841583
{
1585-
auto this_part = val / 10;
1584+
int this_part = val / 10;
15861585
val -= this_part * 10;
15871586
g_string_append(result, gettext(medium_numbers[this_part]));
15881587
g_string_append_c(result, ' ');
15891588
}
15901589

15911590
if (val > 0)
15921591
{
1593-
auto this_part = val;
1592+
int this_part = val;
15941593
g_string_append(result, gettext(small_numbers[this_part]));
15951594
g_string_append_c(result, ' ');
15961595
}

0 commit comments

Comments
 (0)