Rhymond/go-money

Rounding assumes exponent 2

djui opened this issue · 2 comments

djui commented

See: https://github.com/Rhymond/go-money/blob/master/calculator.go#L52

Instead of using 100 is should be something like int64(math.Pow(10, c.Exponent)) or simply a lookup table. Same for 50.

And the readme should state it only supports decimal currencies (i.e. decimals with cents); there are other currencies of base 5 for example.

Thanks @djui! That's a good point.
I'm going to fix this in the next week or if you can open PR you're more than welcome to help.

It's fixed and merged to master