Closed
Description
There are several Go decimal arithmetic libraries to choose from:
- https://github.com/oguzbilgic/fpd
- http://godoc.org/github.com/shopspring/decimal
- http://godoc.org/speter.net/go/exp/math/dec/inf
- This one is used by kubernetes. Is that the best stamp of approval?
These libraries all have essentially the same implementation which is to use math/big.Int
for the integer value and keep a separate scale int
parameter. The values are thus represented as unscaled * 10**(-scale)
.