(n: number)
| 387 | } |
| 388 | |
| 389 | pow(n: number): BigDecimal { |
| 390 | if (this._special === SpecialValue.NAN) return this |
| 391 | if (n === 0) return new BigDecimal(1) |
| 392 | if (n < 0) { |
| 393 | return new BigDecimal(1).div(this.pow(-n)) |
| 394 | } |
| 395 | if (this._special === SpecialValue.POSITIVE_INFINITY) return this |
| 396 | if (this._special === SpecialValue.NEGATIVE_INFINITY) { |
| 397 | return n % 2 === 0 |
| 398 | ? BigDecimal._create(0n, 0, SpecialValue.POSITIVE_INFINITY, false) |
| 399 | : this |
| 400 | } |
| 401 | if (this._mantissa === 0n) return new BigDecimal(0) |
| 402 | const m = this._mantissa ** BigInt(n) |
| 403 | const e = this._exponent * n |
| 404 | const [nm, ne] = removeTrailingZeros(m, e) |
| 405 | return BigDecimal._create(nm, ne, SpecialValue.NONE, false) |
| 406 | } |
| 407 | |
| 408 | floor(): BigDecimal { |
| 409 | if (this._special !== SpecialValue.NONE) return this |
no test coverage detected