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

Documentation fails to mention that unit is sometimes cents #16

Open
cbrunnkvist opened this issue Jun 14, 2016 · 1 comment
Open

Documentation fails to mention that unit is sometimes cents #16

cbrunnkvist opened this issue Jun 14, 2016 · 1 comment

Comments

@cbrunnkvist
Copy link

cbrunnkvist commented Jun 14, 2016

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
@davidkalosi
Copy link
Owner

I think this is clear from the documentation how various construction methods work. If you feel it's confusing feel free to address that with a PR ;)

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