Money icon indicating copy to clipboard operation
Money copied to clipboard

Can't take a percentage

Open mattcorey opened this issue 8 years ago • 1 comments

I can't seem to take a percentage of a Money object accurately, because the 'multiply' override takes a 'Money' object directly, which drops my decimal precision to two place. For example:

var balance: Money = 5000
var interest = balance * .0166666

This should result in $83.33, however I believe the .0166666 is converted to a Money object, which represents it as $.02, meaning the interest variable is set to $100 - not close enough for horseshoes or hand grenades.

mattcorey avatar Jul 22 '17 12:07 mattcorey

Found my solution by taking the minorUnits, but this would still be a nice feature

mattcorey avatar Jul 22 '17 18:07 mattcorey