AUDIT: r17554 - gnucash/trunk/lib/libqof/qof - gnc_numeric: Support reciprocals (negative denominators) in gnc_numeric_to_decimal().

Charles Day cedayiv at cvs.gnucash.org
Thu Sep 18 04:33:27 EDT 2008


Author: cedayiv
Date: 2008-09-18 04:33:27 -0400 (Thu, 18 Sep 2008)
New Revision: 17554
Trac: http://svn.gnucash.org/trac/changeset/17554

Modified:
   gnucash/trunk/lib/libqof/qof/gnc-numeric.c
Log:
gnc_numeric: Support reciprocals (negative denominators) in gnc_numeric_to_decimal().
BP


Modified: gnucash/trunk/lib/libqof/qof/gnc-numeric.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/gnc-numeric.c	2008-09-18 02:26:51 UTC (rev 17553)
+++ gnucash/trunk/lib/libqof/qof/gnc-numeric.c	2008-09-18 08:33:27 UTC (rev 17554)
@@ -1043,7 +1043,15 @@
 
   converted_val = *a;
   if (converted_val.denom <= 0)
-    return FALSE;
+  {
+    converted_val = gnc_numeric_convert(converted_val, 1, GNC_DENOM_EXACT);
+    if (gnc_numeric_check(converted_val) != GNC_ERROR_OK)
+      return FALSE;
+    *a = converted_val;
+    if (max_decimal_places)
+      *max_decimal_places = decimal_places;
+    return TRUE;
+  }
 
   /* Zero is easily converted. */
   if (converted_val.num == 0)



More information about the gnucash-changes mailing list