Copy returns a copy of decimal with the same value and exponent, but a different pointer to value.
()
| 456 | |
| 457 | // Copy returns a copy of decimal with the same value and exponent, but a different pointer to value. |
| 458 | func (d Decimal) Copy() Decimal { |
| 459 | d.ensureInitialized() |
| 460 | return Decimal{ |
| 461 | value: new(big.Int).Set(d.value), |
| 462 | exp: d.exp, |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | // rescale returns a rescaled version of the decimal. Returned |
| 467 | // decimal may be less precise if the given exponent is bigger |