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

Loss of precision relating continuing fractions #6

Open
ysangkok opened this issue Aug 30, 2015 · 0 comments
Open

Loss of precision relating continuing fractions #6

ysangkok opened this issue Aug 30, 2015 · 0 comments

Comments

@ysangkok
Copy link
Collaborator

If you make an expense that involves amounts of money that cannot be represented exactly with a decimal.Decimal, the expense is marked as invalid, and the NetworkX solver will complain, because the individual contribution amounts do not add up to the amount of money used anymore.

For example, create an expense of 1 unit, shared among 3 people. The expense will currently be marked as "invalid" even though it is not.

The underlying reason is that decimals.Decimal is used, and that Decimal("1")/3*3!=Decimal("1"). I believe Tykling did not prefer a pure fractions.Fraction solution, with truncation only when showing to the user, as the amounts would not add up when doing a manual check with the values from the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant