AUDIT: r17456 - gnucash/trunk/lib/libqof/qof - Make gnc_numeric values of zero always convertible to decimal form.

Charles Day cedayiv at cvs.gnucash.org
Thu Aug 7 14:18:01 EDT 2008


Author: cedayiv
Date: 2008-08-07 14:18:00 -0400 (Thu, 07 Aug 2008)
New Revision: 17456
Trac: http://svn.gnucash.org/trac/changeset/17456

Modified:
   gnucash/trunk/lib/libqof/qof/gnc-numeric.c
Log:
Make gnc_numeric values of zero always convertible to decimal form.
BP


Modified: gnucash/trunk/lib/libqof/qof/gnc-numeric.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-numeric.c	2008-08-05 08:07:28 UTC (rev 17455)
+++ gnucash/trunk/lib/libqof/qof/gnc-numeric.c	2008-08-07 18:18:00 UTC (rev 17456)
@@ -1042,10 +1042,14 @@
     return FALSE;
 
   converted_val = *a;
-  fraction = converted_val.denom;
-  if (fraction <= 0)
+  if (converted_val.denom <= 0)
     return FALSE;
 
+  /* Zero is easily converted. */
+  if (converted_val.num == 0)
+    converted_val.denom = 1;
+
+  fraction = converted_val.denom;
   while (fraction != 1)
   {
     switch (fraction % 10)



More information about the gnucash-changes mailing list