godec


multi-precision decimal arithmetic for Go

New development for this package is at https://speter.net/go/exp/math/dec/inf .

API changes between the two packages:

godec             inf.Dec              purpose
---------------------------------------------------------------------------
NewDecInt64(u) NewDec(u,0) favor common case for short API
NewDec(u,s) NewDecBig(u,s) favor common case for short API
(n/a) z.SetUnscaled(u) favor common case for short API
z.SetUnscaled(u) z.SetUnscaledBig(u) favor common case for short API
(n/a) x.Unscaled() consistency (NewDec*/SetUnscaled*)
x.Unscaled() x.UnscaledBig() consistency (NewDec*/SetUnscaled*)
z.Quo(x,y,s,r) z.QuoRound(x,y,s,r) consistency (combined operation)
type Scaler (unexported) hide implementation details

Godec implements multi-precision decimal arithmetic for Go. The API and the implementation are based on and complement those in the multi-precision integer (Int) implementation in the Go library (math/big).

Installation: go get code.google.com/p/godec/dec

See the package docs for details.

Limitations: * Support for formatting options is currently missing. * There is no support for potentially lossy conversions (e.g. float64 to Dec, Dec to int64, or Dec to float64) as the requirements for these usually differ depending on the use case.

Project Information

The project was created on Oct 10, 2012.

Labels:
go golang mathematics math decimal