Hyperlinkv0.8.0-beta.28

BigDecimal

BigDecimal.fromBigIntconsteffect/BigDecimal.ts:1259
(n: bigint): BigDecimal

Creates a BigDecimal from a bigint value.

When to use

Use to construct an integer BigDecimal from a bigint.

Example (Creating decimals from bigint)

import { BigDecimal } from "effect"

const decimal = BigDecimal.fromBigInt(123n)
console.log(BigDecimal.format(decimal)) // "123"

const largeBigInt = BigDecimal.fromBigInt(9007199254740991n)
console.log(BigDecimal.format(largeBigInt)) // "9007199254740991"
constructorsmake
export const fromBigInt = (n: bigint): BigDecimal => make(n, 0)