Skip to content
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.

Which supported datatype is best for handling money amounts? #28

Closed
juandent opened this issue Jul 13, 2017 · 3 comments
Closed

Which supported datatype is best for handling money amounts? #28

juandent opened this issue Jul 13, 2017 · 3 comments

Comments

@juandent
Copy link

juandent commented Jul 13, 2017

Hi Roland,
As I am starting a small project to begin use of your library, I found decimal and numeric are not allowed data types (but they are the only that allow exact 2 decimal places for money amounts). I guess one could use double, but that is not exact.

I would like to know what you suggest.
Thanks!
Juan

@rbock
Copy link
Owner

rbock commented Jul 15, 2017

Hi Juan,

I would use bigint or some other integral type and combine it with information about the currency. Not all currencies have a minor unit that represents 1/100th of the main unit.

Best,

Roland

@juandent
Copy link
Author

Hi Roland

Just to make sure I get that correctly :
all amounts would be multiplied by 100 for storage purposes

I know of a small library that deals with such representation so all would be well!!

Thanks again!

@rbock
Copy link
Owner

rbock commented Jul 15, 2017

Hi Juan,

That sounds good to me.

Best,

Roland

@rbock rbock closed this as completed Jul 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants