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

When i use Round function, Round, RoundBank, RoundCash work fine. When when i try RoundUp and RoundDown, its method not found. Try this: `decimal.NewFromFloat(1.454).RoundDown(1)` Result: `decimal.NewFromFloat(1.454).RoundDown undefined (type decimal.Decimal has...

I understand the reasons why the Min Max functions for decimal are implemented as they are: to allow for evaluation of multiple values. However, would it not be useful to...

```go package main import ( "fmt" "github.com/shopspring/decimal" ) func main() { a := decimal.RequireFromString("4") b := decimal.RequireFromString("2") fmt.Println(a.Exponent()) // 0 fmt.Println(b.Exponent()) // 0 fmt.Println(a.Div(b).Exponent()) // actual: -16, expected: 0 }...

Just out of curiosity, I'd looked into your library, and just found one usage of Pi number as follow: [Pi usage in code `func (d Decimal) satan() Decimal`](https://github.com/shopspring/decimal/blob/ebbf8bbe36744e82feb42bf468dc649d5249bf63/decimal.go#L1347) But using...

Give a public var that can help user call RoundBank(x) automatically when calling Div() and Mul()

I wanted to use your library, but noticed that the function pow does not think correctly. Here is a comparison with math.Pow ```go fmt.Println(decimal.NewFromFloat(1.15).Pow(decimal.NewFromFloat(12.1666667))) // result: 5.350250105473711181640625 ``` ```go fmt.Println(math.Pow(1.15,12.1666667))...

Please consider adding impl `func (d Decimal) Value() (driver.Value, error)`. Referring issue https://github.com/jinzhu/gorm/issues/1250

I noticed in several places, you guys are panicking - with good intentions. The problem is, this makes it a lot harder to "trust" the library will not cause problems...

Hi @vadimg, thanks for your work on this library. Have you considered adding support for the notions of either `NaN` or `+/-Inf`? If not, would you be opposed to me...

As it stands, Decimal does not work as map key. This is because it uses `value *big.Int`. Why not just `value big.Int` ? Is there a real reason it is...