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

Multiply or Divide Money with Money? #9

Closed
andrewtimberlake opened this issue May 24, 2016 · 5 comments
Closed

Multiply or Divide Money with Money? #9

andrewtimberlake opened this issue May 24, 2016 · 5 comments

Comments

@andrewtimberlake
Copy link
Collaborator

Does it make any sense to multiply or divide a Money with a Money?
I don’t usually say $5 * $5, it would be $5 * 5
I also don’t say $5 / $5 but rather $5 / 5

@andrewtimberlake
Copy link
Collaborator Author

A Money implementation I have in Ruby actually does the following:

Money.new(10) / 2
# => [#<Money $5.00>, #<Money $5.00>]

While that initially seemed weird to me, it actually makes sense with how money is used.

Money.new(11) / 3
# => [#<Money $3.67>, #<Money $3.67>, #<Money $3.66>]

@liuggio
Copy link
Collaborator

liuggio commented May 24, 2016

Does it make any sense to multiply or divide a Money with a Money?

I think it doesn't... 👍

About the list as return value
the other way is using upper and lower bound... doesn't look weird to me (your idea I mean).

I think we should add also percentage with this notation, what do you think?

@andrewtimberlake
Copy link
Collaborator Author

Can you elaborate on "upper and lower bound"
Percentage is also a good idea. That would be useful for tax calculations. Any ideas on the interface?

@liuggio
Copy link
Collaborator

liuggio commented May 25, 2016

the other way was to pass options like:
round-up that rounds the money to the smallest integer greater than or equal to num
round-down that rounds the money to the largest integer less than or equal to num

but we could go with your idea... and let's think about it later...

@liuggio
Copy link
Collaborator

liuggio commented May 25, 2016

implemented by #22

@liuggio liuggio closed this as completed May 25, 2016
Fs02 pushed a commit to Fs02/money that referenced this issue Nov 12, 2016
Resolve "Product API"

Closes elixirmoney#9

See merge request !4
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