(y: BigDecimal | number | string | bigint)
| 510 | // --- Comparison --- |
| 511 | |
| 512 | eq(y: BigDecimal | number | string | bigint): boolean { |
| 513 | const other = BigDecimal._coerce(y) |
| 514 | if ( |
| 515 | this._special === SpecialValue.NAN || |
| 516 | other._special === SpecialValue.NAN |
| 517 | ) |
| 518 | return false |
| 519 | if (this._special !== other._special) return false |
| 520 | if (this._special !== SpecialValue.NONE) return true // both same special |
| 521 | if (this._mantissa === 0n && other._mantissa === 0n) return true // 0 == -0 |
| 522 | return ( |
| 523 | this._mantissa === other._mantissa && this._exponent === other._exponent |
| 524 | ) |
| 525 | } |
| 526 | |
| 527 | private _compareTo(other: BigDecimal): number { |
| 528 | // Returns -1, 0, 1 |
no test coverage detected