effect-io-ai

Package: effect
Module: BigInt

BigInt.abs

Determines the absolute value of a given bigint.

When to use

Use to remove the sign from a bigint while preserving its magnitude.

Example (Calculating absolute values)

import { BigInt } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(BigInt.abs(-5n), 5n)
assert.deepStrictEqual(BigInt.abs(0n), 0n)
assert.deepStrictEqual(BigInt.abs(5n), 5n)

Signature

declare const abs: (n: bigint) => bigint

Source

Since v2.0.0