AUDIT: r17533 - gnucash/trunk/src/app-utils - When printing negative quotients, use a minus between the integer and fraction part.

Andreas Köhler andi5 at cvs.gnucash.org
Tue Sep 16 18:59:52 EDT 2008


Author: andi5
Date: 2008-09-16 18:59:52 -0400 (Tue, 16 Sep 2008)
New Revision: 17533
Trac: http://svn.gnucash.org/trac/changeset/17533

Modified:
   gnucash/trunk/src/app-utils/gnc-ui-util.c
Log:
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

Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c	2008-09-16 14:05:12 UTC (rev 17532)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c	2008-09-16 22:59:52 UTC (rev 17533)
@@ -1260,7 +1260,7 @@
   char temp_buf[128];
   gnc_numeric whole, rounding;
   int min_dp, max_dp;
-  gboolean value_is_decimal;
+  gboolean value_is_negative, value_is_decimal;
 
   g_return_val_if_fail (info != NULL, 0);
 
@@ -1271,7 +1271,8 @@
     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);
 
   /* Try to print as decimal. */
@@ -1400,6 +1401,8 @@
 
     if (whole.num == 0)
       *buf = '\0';
+    else if (value_is_negative)
+      strcat(buf, " - ");
     else
       strcat(buf, " + ");
 



More information about the gnucash-changes mailing list