MCPcopy Index your code
hub / github.com/formatjs/formatjs / eq

Method eq

packages/bigdecimal/index.ts:512–525  ·  view source on GitHub ↗
(y: BigDecimal | number | string | bigint)

Source from the content-addressed store, hash-verified

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

Callers 5

bigdecimal.test.tsFile · 0.80
ComputeExponentFunction · 0.80
ToRawPrecisionFunction · 0.80
ToRawFixedFunction · 0.80

Calls 1

_coerceMethod · 0.80

Tested by

no test coverage detected