MCPcopy
hub / github.com/formatjs/formatjs / toNumber

Method toNumber

packages/bigdecimal/index.ts:634–640  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

632 }
633
634 toNumber(): number {
635 if (this._special === SpecialValue.NAN) return NaN
636 if (this._special === SpecialValue.POSITIVE_INFINITY) return Infinity
637 if (this._special === SpecialValue.NEGATIVE_INFINITY) return -Infinity
638 if (this._mantissa === 0n) return this._negativeZero ? -0 : 0
639 return Number(this.toString())
640 }
641
642 toString(): string {
643 if (this._special === SpecialValue.NAN) return 'NaN'

Callers 14

powMethod · 0.80
bigdecimal.test.tsFile · 0.80
ToLocalTimeFunction · 0.80
FormatDateTimePatternFunction · 0.80
ToIntegerIfIntegralFunction · 0.80
GetOperandsFunction · 0.80
ResolvePluralInternalFunction · 0.80
ComputeExponentFunction · 0.80
ToRawPrecisionFunction · 0.80

Calls 1

toStringMethod · 0.95

Tested by

no test coverage detected