mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
When printing negative quotients, use a minus between the integer and fraction part.
Previously: print g_n_c(-4, 3) => "-1 + 1/3", now "-1 - 1/3". BP git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17533 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
96e3da5b76
commit
609533e88d
@ -1260,7 +1260,7 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
|||||||
char temp_buf[128];
|
char temp_buf[128];
|
||||||
gnc_numeric whole, rounding;
|
gnc_numeric whole, rounding;
|
||||||
int min_dp, max_dp;
|
int min_dp, max_dp;
|
||||||
gboolean value_is_decimal;
|
gboolean value_is_negative, value_is_decimal;
|
||||||
|
|
||||||
g_return_val_if_fail (info != NULL, 0);
|
g_return_val_if_fail (info != NULL, 0);
|
||||||
|
|
||||||
@ -1271,7 +1271,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the absolute value */
|
/* Print the absolute value, but remember negativity */
|
||||||
|
value_is_negative = gnc_numeric_negative_p (val);
|
||||||
val = gnc_numeric_abs (val);
|
val = gnc_numeric_abs (val);
|
||||||
|
|
||||||
/* Try to print as decimal. */
|
/* Try to print as decimal. */
|
||||||
@ -1400,6 +1401,8 @@ PrintAmountInternal(char *buf, gnc_numeric val, const GNCPrintAmountInfo *info)
|
|||||||
|
|
||||||
if (whole.num == 0)
|
if (whole.num == 0)
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
else if (value_is_negative)
|
||||||
|
strcat(buf, " - ");
|
||||||
else
|
else
|
||||||
strcat(buf, " + ");
|
strcat(buf, " + ");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user