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

Money.add() still sometimes return wrong value #5

Closed
dan-lind opened this issue Nov 14, 2014 · 1 comment
Closed

Money.add() still sometimes return wrong value #5

dan-lind opened this issue Nov 14, 2014 · 1 comment

Comments

@dan-lind
Copy link

Opening a new ticket since I'm not sure what is the root cause, and the number returned is not negative. Rough testcase:

public void testBigDecimals() {
        Money sum = MoneyFactory.fromCharSequence("22543.6089278196672");
        Money toAdd = MoneyFactory.fromCharSequence("805.694827586206976");
        Money newSum = sum.add(toAdd);
        assertTrue("Value too small: " + newSum, newSum.toDouble() > 22000);
}

The sum here should be something above 23000, but this test fails with:
Value too small: 4902.55968169632256

@mikvor
Copy link
Owner

mikvor commented Nov 14, 2014

Added 2 more overflow checks.

@mikvor mikvor closed this as completed Nov 14, 2014
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

2 participants