decimal icon indicating copy to clipboard operation
decimal copied to clipboard

Arbitrary-precision fixed-point decimal numbers in Go

Results 140 decimal issues
Sort by recently updated
recently updated
newest added

Actual example comment: `NewFromFloat(-1.454).RoundCeil(1).String() // output: "-1.5"` Must be: `NewFromFloat(-1.454).RoundCeil(1).String() // output: "-1.4"` Actual example comment: `NewFromFloat(-1.454).RoundFloor(1).String() // output: "-1.4"` Must be: `NewFromFloat(-1.454).RoundFloor(1).String() // output: "-1.5"` Actual example comment: `NewFromFloat(-1.454).RoundDown(1).String()...

I found a precision problem: ``` a, _ := decimal.NewFromString("1") b, _ := decimal.NewFromString("3") c := a.Div(b) fmt.Println(c.StringFixed(30)) The result is `0.333333333333333300000000000000`, but I think `0.333333333333333333333333333333` is expected.

Zero should not be exposed to the public, which will lead to someone being able to modify Zero, it is recommended to adjust

I think one and hundred both of them are used a lot in the application (my application). Example I want to find Price after Discount I have to write: ```go...

we need to print Go-syntax representation of decimal variables. ``` package main import ( "fmt" "github.com/shopspring/decimal" ) func main() { one := decimal.NewFromInt(1) fmt.Printf("%#v\n", one) //print: decimal.Decimal{value:(*big.Int)(0xc00011e3a0), exp:0} //expected: decimal.NewFromString("1")...

While working with a few currency exchanges' APIs I noticed that some of them specify the exchange price incrementation/decrementation number (aka step), so in this PR I've added a method...

hi, I wonder if there's any way to convert a long formula into decimal expression, for example ``` A * D - B * C * E + C *...

Removing the `min()` func from `RescalePair()` stops the copy operation for passing the values into `min()` saving on the bytes per op and marginal decreases in runtime. For fun I...

Note: Marshal max digits is 31. it decimal.IntPart large than 31,it will be lose extra digits.

How to get string with thousands separator? e.g 4,294,967.45 for 4294967.45