effect-io-ai

Package: effect
Module: BigDecimal

BigDecimal.Order

Provides an Order instance for BigDecimal that allows comparing and sorting BigDecimal values.

When to use

Use when you need to sort or compare decimal values through APIs that accept an ordering instance.

Example (Comparing decimals)

import { BigDecimal } from "effect"

const a = BigDecimal.fromNumberUnsafe(1.5)
const b = BigDecimal.fromNumberUnsafe(2.3)
const c = BigDecimal.fromNumberUnsafe(1.5)

console.log(BigDecimal.Order(a, b)) // -1 (a < b)
console.log(BigDecimal.Order(b, a)) // 1 (b > a)
console.log(BigDecimal.Order(a, c)) // 0 (a === c)

Signature

declare const Order: order.Order<BigDecimal>

Source

Since v2.0.0