go-money icon indicating copy to clipboard operation
go-money copied to clipboard

fixed NewFromFloat to calculate accurate values

Open kotaroyamazaki opened this issue 2 years ago • 2 comments

Multiplying floats by primitive types is not precise enough, and there is a serious bug that the amount generated by NewFromFloat is different from the original value. issue : https://github.com/Rhymond/go-money/issues/121, #124

Fixed to use "github.com/shopspring/decimal" for float multiplication.

This fix requires a dependency on an external module,, but I could find no other idea.

kotaroyamazaki avatar Nov 08 '22 11:11 kotaroyamazaki

Hello there! There is an approximate date when this change would be integrated into master? Or some other approach where this bug would be fixed?

azlancpool avatar Dec 12 '22 20:12 azlancpool

Hello @kotaroyamazaki, is there any update on this PR? Thank you

ahummel25 avatar Jun 27 '23 14:06 ahummel25