Round properly when computing fraction of the transaction's value due to a given split.

Also use GNC-DENOM-AUTO instead of a constant zero when appropriate.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22976 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2013-05-12 03:41:41 +00:00
parent 03c3a6d115
commit d339141394

View File

@ -254,7 +254,7 @@
(not (null? s-account)) ;; any dangling splits
(not (account-in-list? s-account accounts))
;; only consider splits of opposite sign
(gnc-numeric-negative-p (gnc-numeric-mul s-value split-value 0 GNC-DENOM-REDUCE))
(gnc-numeric-negative-p (gnc-numeric-mul s-value split-value GNC-DENOM-AUTO GNC-DENOM-REDUCE))
)
(if (not (split-in-list? s seen-split-list))
(let (
@ -272,11 +272,12 @@
(gnc:make-gnc-numeric 1 1)
;; else
(gnc-numeric-abs
(gnc-numeric-div split-value transaction-value 0 GNC-DENOM-REDUCE)
(gnc-numeric-div split-value transaction-value GNC-DENOM-AUTO GNC-DENOM-REDUCE)
)
)
)
(set! s-value (gnc-numeric-mul split-transaction-ratio s-value GNC-DENOM-AUTO GNC-RND-ROUND))
(set! s-value (gnc-numeric-mul split-transaction-ratio s-value
(gnc-commodity-get-fraction parent-currency) GNC-RND-ROUND))
(set! seen-split-list (cons s seen-split-list))
(if (gnc-numeric-negative-p s-value)
;; -----------------------------------------------