price scrub tweak

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@9391 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 2003-09-21 18:33:35 +00:00
parent 3b6d67f15f
commit 6b09a496ba
2 changed files with 13 additions and 6 deletions

View File

@ -225,7 +225,7 @@ is_subsplit (Split *split)
/* ================================================================= */
void
xaccScrubSubSplitPrice (Split *split)
xaccScrubSubSplitPrice (Split *split, int maxmult, int maxamtscu)
{
gnc_numeric src_amt, src_val;
SplitList *node;
@ -267,10 +267,10 @@ xaccScrubSubSplitPrice (Split *split)
*/
delta = gnc_numeric_sub_fixed (target_val, dst_val);
delta = gnc_numeric_abs (delta);
if (3 * delta.num < delta.denom) continue;
if (maxmult * delta.num < delta.denom) continue;
/* If the amount is small, pass on that too */
if ((-2 < dst_amt.num) && (dst_amt.num < 2)) continue;
if ((-maxamtscu < dst_amt.num) && (dst_amt.num < maxamtscu)) continue;
/* Make the actual adjustment */
xaccTransBeginEdit (txn);

View File

@ -85,11 +85,18 @@ void xaccLotScrubDoubleBalance (GNCLot *lot);
*
* There is a bit of a problem with the interpretation of 'rounding
* errors' because there are pathological corner cases of small
* amounts. So this routine is fairly loose, hopefully loose enough
* so that the user can manually fine tune without having this routine
* amounts. So this routine is loose, hopefully loose enough so
* that the user can manually fine tune without having this routine
* clobber thier work.
*
* This routine ignores price differences smaller than 1/maxmult.
* This routine ignores price differences when the split with a crazy
* price involes only a small amount: specifically, an amount that
* is less than maxamtscu/amount.denom.
*
* Reasonable/recommended values might be maxmult=3, maxamtscu = 2.
*/
void xaccScrubSubSplitPrice (Split *split);
void xaccScrubSubSplitPrice (Split *split, int maxmult, int maxamtscu);
/** The xaccScrubMergeSubSplits() routine will merge together
* all of the splits that were at one time split off from this