effect-io-ai

Package: effect
Module: BigDecimal

BigDecimal.negate

Provides a negate operation on BigDecimals.

When to use

Use to flip the sign of a BigDecimal.

Example (Negating decimals)

import { BigDecimal } from "effect"
import * as assert from "node:assert"

assert.deepStrictEqual(BigDecimal.negate(BigDecimal.fromStringUnsafe("3")), BigDecimal.fromStringUnsafe("-3"))
assert.deepStrictEqual(BigDecimal.negate(BigDecimal.fromStringUnsafe("-6")), BigDecimal.fromStringUnsafe("6"))

Signature

declare const negate: (n: BigDecimal) => BigDecimal

Source

Since v2.0.0