Skip to main content Link Search Menu Expand Document (external link)

BigDecimal overview

A simple extension to the Effect BigDecimal module


Table of contents


Constructors

fromPrimitive

Function that creates a Bigdecimal from a scale and a primitive representing a bigint

Signature

export declare const fromPrimitive: (
  scale: number
) => MTypes.OneArgFunction<string | number | boolean, Either.Either<BigDecimal.BigDecimal, Brand.Brand.BrandErrors>>

fromPrimitiveOption

Function that creates an Option of a Bigdecimal from a scale and a primitive representing a bigint

Signature

export declare const fromPrimitiveOption: (
  scale: number
) => MTypes.OneArgFunction<string | number | boolean, Option.Option<BigDecimal.BigDecimal>>

fromPrimitiveOrThrow

Function that creates a Bigdecimal from a scale and a string representing a bigint

Signature

export declare const fromPrimitiveOrThrow: (
  scale: number
) => MTypes.OneArgFunction<string | number | boolean, BigDecimal.BigDecimal>

Destructors

truncatedAndFollowingParts

Returns truncatedPart, self truncated after precision decimal digits, and followingpart, the difference between self and truncatedPart. precision must be a positive finite integer. If not provided, precision is taken equal to 0.

Signature

export declare const truncatedAndFollowingParts: (
  precision?: number
) => (self: BigDecimal.BigDecimal) => [truncatedPart: BigDecimal.BigDecimal, followingpart: BigDecimal.BigDecimal]

Instances

zero

BigDecimal instance representing the 0 value

Signature

export declare const zero: BigDecimal.BigDecimal

Utils

trunc

Truncates a BigDecimal after precision decimal digits. precision must be a positive finite integer. If not provided, precision is taken equal to 0.

Signature

export declare const trunc: (precision?: number) => MTypes.OneArgFunction<BigDecimal.BigDecimal>