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.
> 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'.
2 comments
[ 3.0 ms ] story [ 16.9 ms ] threadI think the proper/common name for this is 'allocation', not 'division'.
For example, see https://frontstuff.io/how-to-handle-monetary-values-in-javas... and look for the subheading 'Pitfall #3: Percentage vs. allocation'.