Package: effect
Module: BigDecimal
Rounds a BigDecimal at the given scale with the specified rounding mode.
Example
import * as assert from "node:assert"
import { round, unsafeFromString } from "effect/BigDecimal"
assert.deepStrictEqual(round(unsafeFromString("145"), { mode: "from-zero", scale: -1 }), unsafeFromString("150"))
assert.deepStrictEqual(round(unsafeFromString("-14.5")), unsafeFromString("-15"))
Signature
declare const round: { (options: { scale?: number; mode?: RoundingMode; }): (self: BigDecimal) => BigDecimal; (n: BigDecimal, options?: { scale?: number; mode?: RoundingMode; }): BigDecimal; }
Since v3.16.0