ardanlabs / service

Starter-kit for writing services in Go using Kubernetes.
https://www.ardanlabs.com
Apache License 2.0
3.4k stars 613 forks source link

Question: Is it safe to use float for cost? #373

Closed Ali-Farhadnia closed 1 month ago

Ali-Farhadnia commented 1 month ago

I have used decimal.Decimal (github.com/shopspring/decimal) for cost calculations and it was ok for me.

ardan-bkennedy commented 1 month ago

If float was not going to work, your next best solution is to use an int and keep everything in pennies. I don't that is important for this project.