mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Teach PrintAmountInternal() to correctly handle a reciprocal denominator.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13091 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1198,8 +1198,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
||||
}
|
||||
|
||||
/* calculate the integer part and the remainder */
|
||||
whole = gnc_numeric_create (val.num / val.denom, 1);
|
||||
val = gnc_numeric_sub (val, whole, val.denom, GNC_RND_NEVER);
|
||||
whole = gnc_numeric_convert(val, 1, GNC_HOW_RND_TRUNC);
|
||||
val = gnc_numeric_sub (val, whole, GNC_DENOM_AUTO, GNC_HOW_RND_NEVER);
|
||||
if (gnc_numeric_check (val))
|
||||
{
|
||||
PWARN ("Problem with remainder.");
|
||||
@@ -1282,9 +1282,12 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
||||
{
|
||||
val = gnc_numeric_reduce (val);
|
||||
|
||||
sprintf (temp_buf, " + %" G_GINT64_FORMAT " / %" G_GINT64_FORMAT,
|
||||
val.num,
|
||||
val.denom);
|
||||
if (val.denom > 0)
|
||||
sprintf (temp_buf, " + %" G_GINT64_FORMAT " / %" G_GINT64_FORMAT,
|
||||
val.num, val.denom);
|
||||
else
|
||||
sprintf (temp_buf, " + %" G_GINT64_FORMAT " * %" G_GINT64_FORMAT,
|
||||
val.num, -val.denom);
|
||||
|
||||
strcat (buf, temp_buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user