precise_decimal library

Arbitrary-precision decimal arithmetic with explicit scale preservation.

The package models decimal values as unscaledValue * 10^(-scale) and preserves the parsed or constructed scale unless a caller explicitly changes it.

Classes

BigDecimal
Immutable arbitrary-precision decimal value represented as unscaledValue * 10^(-scale).
DecimalContext
Immutable configuration for decimal operations that require rounding or precision limiting (e.g. division).
DecimalOperationResult<T>
Immutable result of a decimal operation that can emit GDA conditions.
FiniteDecimal
Finite decimal value represented as unscaledValue * 10^(-scale).
InfinityDecimal
Positive or negative infinity.
NaNDecimal
Quiet or signaling not-a-number value.

Enums

DecimalCondition
IEEE 754 / GDA condition that can be signaled during decimal arithmetic.
DecimalForm
High-level numeric form of a BigDecimal value.
RoundingMode
Supported decimal rounding strategies.

Extensions

DoubleToBigDecimal on double
Ergonomic conversions from double to BigDecimal.
IntToBigDecimal on int
Ergonomic conversion from int to BigDecimal.

Exceptions / Errors

BigDecimalArithmeticException
Exception thrown when an arithmetic operation fails.
BigDecimalConversionException
Exception thrown when a decimal conversion fails.
BigDecimalException
Base interface for package-specific decimal failures.
BigDecimalOverflowException
Exception thrown when a result exceeds the supported exponent range.
BigDecimalParseException
Exception thrown when a parse operation fails.
BigDecimalSignalException
Exception thrown when a DecimalCondition is signaled and the active DecimalContext is configured to trap it.