Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add's balancing default amounts get confused by changing precision #19

Closed
simonmichael opened this issue Apr 8, 2013 · 2 comments
Closed
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. imported These came from the old Google issue tracker.

Comments

@simonmichael
Copy link
Owner

Original author: simon@joyful.com (February 16, 2010 04:28:04)

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.

Original issue: http://code.google.com/p/hledger/issues/detail?id=19

@simonmichael
Copy link
Owner Author

From simon@joyful.com on February 16, 2010 04:37:26
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.

@simonmichael
Copy link
Owner Author

From simon@joyful.com on February 16, 2010 05:24:10
Fixed in darcs, though amount code refactoring is getting more urgent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-BUG Something wrong, confusing or sub-standard in the software, docs, or user experience. imported These came from the old Google issue tracker.
Projects
None yet
Development

No branches or pull requests

1 participant