mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
Compare commits
1 commit
4f9175c00f
...
8407d72bab
Author | SHA1 | Date | |
---|---|---|---|
|
8407d72bab |
1 changed files with 3 additions and 4 deletions
|
@ -129,10 +129,9 @@ func NewFromBigInt(value *big.Int, exp int32) Decimal {
|
||||||
//
|
//
|
||||||
// Example:
|
// Example:
|
||||||
//
|
//
|
||||||
// d1 := NewFromBigRat(big.NewRat(0, 1), 0) // output: "0"
|
// d1, err := NewFromBigRat(big.NewRat(0, 1), 4)
|
||||||
// d2 := NewFromBigRat(big.NewRat(4, 5), 1) // output: "0.8"
|
// d2, err := NewFromBigRat(big.NewRat(4, 5), 100)
|
||||||
// d3 := NewFromBigRat(big.NewRat(1000, 3), 3) // output: "333.333"
|
// d3, err := NewFromBigRat(big.NewRat(10000, 3), 300)
|
||||||
// d4 := NewFromBigRat(big.NewRat(2, 7), 4) // output: "0.2857"
|
|
||||||
//
|
//
|
||||||
func NewFromBigRat(value *big.Rat, precision int32) Decimal {
|
func NewFromBigRat(value *big.Rat, precision int32) Decimal {
|
||||||
return Decimal{
|
return Decimal{
|
||||||
|
|
Loading…
Reference in a new issue