Skip to content

Balance calculation fails #5

@dvabuzyarov

Description

@dvabuzyarov

I have a transaction that is fine in ledger:

2019/07/12 * box
55:assets:box -55 HUMMER @ 5372 EUR
55:expenses:delivery -1,700 EUR
55:expenses:delivery -13,818.44 EUR
55:assets:box 55 HUMMER @ 5,654.15345 EUR

but it fails with nledger
The root cause is that the balance of this transaction is visible as -0, and the IsZero property returns false.

        [TestMethod]
        public void Test()
        {
            var amount1 = new Amount(10.16);
            var amount2 = new Amount(-10.15345);
            Value balance = null;
            balance = Value.AddOrSetValue(balance, Value.Get(amount1));
            balance = Value.AddOrSetValue(balance, Value.Get(amount2));
            Assert.IsTrue(balance.IsZero);
        }

I would be happy to assist to sort it out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions