MCPcopy
hub / github.com/formatjs/formatjs / negated

Method negated

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

Source from the content-addressed store, hash-verified

368 }
369
370 negated(): BigDecimal {
371 if (this._special === SpecialValue.NAN) return this
372 if (this._special === SpecialValue.POSITIVE_INFINITY) {
373 return BigDecimal._create(0n, 0, SpecialValue.NEGATIVE_INFINITY, false)
374 }
375 if (this._special === SpecialValue.NEGATIVE_INFINITY) {
376 return BigDecimal._create(0n, 0, SpecialValue.POSITIVE_INFINITY, false)
377 }
378 if (this._mantissa === 0n) {
379 return BigDecimal._create(0n, 0, SpecialValue.NONE, !this._negativeZero)
380 }
381 return BigDecimal._create(
382 -this._mantissa,
383 this._exponent,
384 SpecialValue.NONE,
385 false
386 )
387 }
388
389 pow(n: number): BigDecimal {
390 if (this._special === SpecialValue.NAN) return this

Callers 5

minusMethod · 0.80
bigdecimal.test.tsFile · 0.80
FormatNumericToStringFunction · 0.80
ComputeExponentFunction · 0.80
ToIntegerFunction · 0.80

Calls 1

_createMethod · 0.80

Tested by

no test coverage detected