Package: effect
Module: BigDecimal
Computes the ceiling of a BigDecimal at the given scale.
When to use
Use to round a decimal toward positive infinity at a requested scale.
Details
The default scale is 0. Positive scales keep digits to the right of the
decimal point, and negative scales round positions to the left of the decimal
point.
See
floor for rounding toward negative infinitytruncate for rounding toward zeroround for configurable rounding modesExample (Rounding decimals up)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
BigDecimal.ceil(BigDecimal.fromStringUnsafe("145"), -1),
BigDecimal.fromStringUnsafe("150")
)
assert.deepStrictEqual(BigDecimal.ceil(BigDecimal.fromStringUnsafe("-14.5")), BigDecimal.fromStringUnsafe("-14"))
Signature
declare const ceil: { (scale: number): (self: BigDecimal) => BigDecimal; (self: BigDecimal, scale?: number): BigDecimal; }
Since v3.16.0