Package: effect
Module: BigDecimal
Computes the floor of a BigDecimal at the given scale.
When to use
Use to round a decimal toward negative infinity at a requested scale.
Example (Rounding decimals down)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
BigDecimal.floor(BigDecimal.fromStringUnsafe("145"), -1),
BigDecimal.fromStringUnsafe("140")
)
assert.deepStrictEqual(
BigDecimal.floor(BigDecimal.fromStringUnsafe("-14.5")),
BigDecimal.fromStringUnsafe("-15")
)
See
ceil for rounding toward positive infinitytruncate for rounding toward zeroround for configurable rounding modesSignature
declare const floor: { (scale: number): (self: BigDecimal) => BigDecimal; (self: BigDecimal, scale?: number): BigDecimal; }
Since v3.16.0