go - Round all decimal points in Golang …
https://stackoverflow.com/questions/52048218/round-all-decimal-points-in-golang
Multiply the number by the number of decimals you want to save, then round, then divide it back again. Use github.com/shopspring/decimal, which is a package for "arbitrary-precision fixed-point decimal numbers in go". It can "only" represent numbers with a maximum of 2^31 digits after the decimal point. Use float64, and convert all your ints into floats before calculations.
Multiply the number by the number of decimals you want to save, then round, then divide it back again.
Use github.com/shopspring/decimal, which is a package for "arbitrary-precision fixed-point decimal numbers in go". It can "only" represent numbers with a maximum of 2^31 digits after the decimal point.
Use float64, and convert all your ints into floats before calculations.
DA: 33 PA: 41 MOZ Rank: 71