PowBigInt returns d to the power of exp, where exp is big.Int. Only returns error when d and exp is 0, thus result is undefined. When exponent is negative the returned decimal will have maximum precision of PowPrecisionNegativeExponent places after decimal point. Example: d1, err := decimal.NewF
(exp *big.Int)
| 910 | // d2, err := decimal.NewFromFloat(629.25).PowBigInt(big.NewInt(5)) |
| 911 | // d2.String() // output: "98654323103449.5673828125" |
| 912 | func (d Decimal) PowBigInt(exp *big.Int) (Decimal, error) { |
| 913 | return d.powBigIntWithPrecision(exp, int32(PowPrecisionNegativeExponent)) |
| 914 | } |
| 915 | |
| 916 | func (d Decimal) powBigIntWithPrecision(exp *big.Int, precision int32) (Decimal, error) { |
| 917 | if d.IsZero() && exp.Sign() == 0 { |