You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can see the need to internally store the amount in a different format than a floating point Number, but I think it would make total sense to hide that implementation detail from the rest outside world. Otherwise, you easily end up with situations where suddenly, $100 has grown into $10000 for no apparent reason, aside from the joy it might bring to your accounting department. :)
Look at these examples:
> (new Money(1, Money.USD)).compare( new Money(1, Money.USD) )
0 // true
> Money.fromDecimal(1.0, Money.USD).compare( new Money(1, Money.USD) )
1 // uh oh
The text was updated successfully, but these errors were encountered:
I can see the need to internally store the amount in a different format than a floating point Number, but I think it would make total sense to hide that implementation detail from the rest outside world. Otherwise, you easily end up with situations where suddenly, $100 has grown into $10000 for no apparent reason, aside from the joy it might bring to your accounting department. :)
Look at these examples:
The text was updated successfully, but these errors were encountered: