
Show HN: Currency, a Go package to do currency computations - bnkamalesh
https://github.com/bnkamalesh/currency
======
bnkamalesh
Currency package helps you do exactly what it says, currency computations. It
lets you do sub-unit(e.g. cents is a sub-unit of dollar) manipulations as
well. It takes care of carry over values in division, i.e. consider 1 dollar
divided by 3, it'll return 3 currency instances with 34, 33, 33 as the values
instead of 33.3333.

~~~
bengtan
> It takes care of carry over values in division, i.e. consider 1 dollar
> divided by 3, it'll return 3 currency instances with 34, 33, 33 as the
> values instead of 33.3333.

I think the proper/common name for this is 'allocation', not 'division'.

For example, see [https://frontstuff.io/how-to-handle-monetary-values-in-
javas...](https://frontstuff.io/how-to-handle-monetary-values-in-javascript)
and look for the subheading 'Pitfall #3: Percentage vs. allocation'.

