(value: bigint, scale: number): BigDecimalCreates 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
Source effect/BigDecimal.ts:1346 lines
export const const make: (
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"
make = (value: bigintvalue: bigint, scale: numberscale: number): BigDecimal => {
const const o: anyo = var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.create(o: object | null): any (+1 overload)Creates an object that has the specified prototype or that has null prototype.
create(const BigDecimalProto: Omit<
BigDecimal,
"value" | "scale" | "normalized"
>
BigDecimalProto)
const o: anyo.value = value: bigintvalue
const o: anyo.scale = scale: numberscale
return const o: anyo
}Referenced by 18 symbols
BigDecimal.absBigDecimal.ceilBigDecimal.divideBigDecimal.divideUnsafeBigDecimal.floorBigDecimal.fromBigIntBigDecimal.fromNumberBigDecimal.fromStringBigDecimal.multiplyBigDecimal.negateBigDecimal.remainderBigDecimal.remainderUnsafeBigDecimal.roundBigDecimal.scaleBigDecimal.subtractBigDecimal.sumBigDecimal.truncateSchema.BigDecimal