MCPcopy
hub / github.com/formatjs/formatjs / times

Method times

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

Source from the content-addressed store, hash-verified

229 // --- Arithmetic ---
230
231 times(y: BigDecimal | number | string | bigint): BigDecimal {
232 const other = BigDecimal._coerce(y)
233 if (this._special || other._special) {
234 return this._specialArith(other, 'times')
235 }
236 if (this._mantissa === 0n || other._mantissa === 0n) {
237 const negZero = this._isSignNegative()
238 ? !other._isSignNegative()
239 : other._isSignNegative()
240 return BigDecimal._create(0n, 0, SpecialValue.NONE, negZero)
241 }
242 const m = this._mantissa * other._mantissa
243 const e = this._exponent + other._exponent
244 const [nm, ne] = removeTrailingZeros(m, e)
245 return BigDecimal._create(nm, ne, SpecialValue.NONE, false)
246 }
247
248 div(y: BigDecimal | number | string | bigint): BigDecimal {
249 const other = BigDecimal._coerce(y)

Callers 11

bigdecimal.test.tsFile · 0.80
FormatDateTimePatternFunction · 0.80
ComputeExponentFunction · 0.80
findN1E1R1Function · 0.80
findN2E2R2Function · 0.80
PartitionNumberPatternFunction · 0.80
ToRawFixedFnFunction · 0.80
findN1R1Function · 0.80
findN2R2Function · 0.80
formatToPartsFunction · 0.80

Calls 5

_specialArithMethod · 0.95
_isSignNegativeMethod · 0.95
removeTrailingZerosFunction · 0.85
_coerceMethod · 0.80
_createMethod · 0.80

Tested by

no test coverage detected