Hyperlinkv0.8.0-beta.28

BigDecimal

BigDecimal.makeconsteffect/BigDecimal.ts:134
(value: bigint, scale: number): BigDecimal

Creates a BigDecimal from a bigint value and a scale.

When to use

Use to construct a decimal directly from its unscaled integer value and decimal scale.

Example (Creating decimals from bigint and scale)

import { BigDecimal } from "effect"

// Create 123.45 (12345 with scale 2)
const decimal = BigDecimal.make(12345n, 2)
console.log(BigDecimal.format(decimal)) // "123.45"

// Create 42 (42 with scale 0)
const integer = BigDecimal.make(42n, 0)
console.log(BigDecimal.format(integer)) // "42"
constructorsfromBigInt
export const make = (value: bigint, scale: number): BigDecimal => {
  const o = Object.create(BigDecimalProto)
  o.value = value
  o.scale = scale
  return o
}
Referenced by 18 symbols