diff --git a/lib/libqof/qof/gnc-numeric.c b/lib/libqof/qof/gnc-numeric.c index 6251837653..0855c7e279 100644 --- a/lib/libqof/qof/gnc-numeric.c +++ b/lib/libqof/qof/gnc-numeric.c @@ -1043,7 +1043,15 @@ gnc_numeric_to_decimal(gnc_numeric *a, guint8 *max_decimal_places) 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)