MCPcopy
hub / github.com/formatjs/formatjs / removeTrailingZeros

Function removeTrailingZeros

packages/bigdecimal/index.ts:11–21  ·  view source on GitHub ↗
(
  mantissa: bigint,
  exponent: number
)

Source from the content-addressed store, hash-verified

9}
10
11function removeTrailingZeros(
12 mantissa: bigint,
13 exponent: number
14): [bigint, number] {
15 if (mantissa === 0n) return [0n, 0]
16 while (mantissa % 10n === 0n) {
17 mantissa /= 10n
18 exponent++
19 }
20 return [mantissa, exponent]
21}
22
23function bigintAbs(n: bigint): bigint {
24 return n < 0n ? -n : n

Callers 9

parseDecimalStringFunction · 0.85
constructorMethod · 0.85
timesMethod · 0.85
divMethod · 0.85
plusMethod · 0.85
modMethod · 0.85
powMethod · 0.85
floorMethod · 0.85
ceilMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected