Issue 19 in hledger: add's balancing default amounts get confused by changing precision

1 view
Skip to first unread message

codesite...@google.com

unread,
Feb 15, 2010, 11:28:17 PM2/15/10
to hle...@googlegroups.com
Status: Accepted
Owner: si...@joyful.com
Labels: Type-Defect Priority-Medium Component-UI

New issue 19 by si...@joyful.com: add's balancing default amounts get
confused by changing precision
http://code.google.com/p/hledger/issues/detail?id=19

Reported by Roman. Example:

$ darcs add
Enter one or more transactions, which will be added to your ledger file.
To complete a transaction, enter . as account name. To quit, press control-
c.
date [2010/02/13]:
description: sample transaction
account 1: acc1
amount 1 [0]: 13.75
account 2: acc2
amount 2 [-13.75]: 2.5
account 3: acc3
amount 3 [-16.3]: <Enter>
account 4: .
could not balance this transaction, amounts do not add up to zero. Re-
enter:

What is the expected output? What do you see instead?

For amount 3, the default should have been -16.25, not -16.3.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

unread,
Feb 15, 2010, 11:38:19 PM2/15/10
to hle...@googlegroups.com

Comment #1 on issue 19 by si...@joyful.com: add's balancing default amounts

My "fix a tricky mixedamount arithmetic bug" patch on 2009/11/25 changed
amountop's doc from:

Apply a binary arithmetic operator to two amounts - converting to the
second one's commodity, adopting the lowest precision...

to:

Apply a binary arithmetic operator to two amounts, converting to the
second one's commodity (and display precision)...

but did not change any code to effect this change as far as I can tell.

That aside, during add I think we should assume trailing zeroes on all
amounts and a
display precision equal to the highest precision so far entered in this
transaction.

codesite...@google.com

unread,
Feb 16, 2010, 12:24:38 AM2/16/10
to hle...@googlegroups.com
Updates:
Status: Fixed

Comment #2 on issue 19 by si...@joyful.com: add's balancing default amounts

Fixed in darcs, though amount code refactoring is getting more urgent.

Reply all
Reply to author
Forward
0 new messages