Package: effect
Module: BigDecimal
Determines the absolute value of a given BigDecimal.
When to use
Use to remove the sign from a BigDecimal while preserving its magnitude.
Example (Calculating absolute values)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(BigDecimal.abs(BigDecimal.fromStringUnsafe("-5")), BigDecimal.fromStringUnsafe("5"))
assert.deepStrictEqual(BigDecimal.abs(BigDecimal.fromStringUnsafe("0")), BigDecimal.fromStringUnsafe("0"))
assert.deepStrictEqual(BigDecimal.abs(BigDecimal.fromStringUnsafe("5")), BigDecimal.fromStringUnsafe("5"))
Signature
declare const abs: (n: BigDecimal) => BigDecimal
Since v2.0.0