Releases: kormium/decimal
Releases · kormium/decimal
Release list
v0.1.0 — 2026-07-04 — the multiplatform decimal value type
Initial release.
Added
- Compact
Longsignificands: values of up to 18 digits are stored in aLong
(java'sintCompactapproach) with fast paths for parse,plus/minus,times,
div/divideToIntegral,compareTo,setScale,hashCode,toLongand
stripTrailingZeros; longer significands use exact digit-string arithmetic.
Representation-invisible in the API; verified by the same differential oracle.
Money-profile effect:plusandparseatjava.math.BigDecimalparity on the JVM,
2-50× ahead of ionspin bignum across the board incl. native (tables in the README). - Division:
div(other, scale, roundingMode)(both always explicit — deliberately no/
operator),divideToIntegral(java preferred-scale semantics) and the exact%operator
(sign follows the dividend). Division by zero always throws, even for special values. - Mixed-operand
+,-,×withIntandLongin both directions, anddiv/rem
overloads (Doubleis deliberately excluded — binary-float noise must be converted
explicitly). - Benchmarks module (kotlinx-benchmark/JMH):
Decimalvsjava.math.BigDecimalvs
ionspin bignum, money-profile and 30-digit corpora, JVM + native. Decimal: an immutable arbitrary-precision decimal value type in pure common Kotlin.
java.math.BigDecimal-compatible parse/toString/toPlainString grammar and formatting,
scale/precision/signum,stripTrailingZeros,movePointLeft/movePointRight,
conversions (toDouble/toFloat/toLong/toInt+…Exactvariants), factories
(parse,of(unscaled, scale),of(Long/Int),fromDouble) andString/Long/Int/
DoubletoDecimal()extensions.- Exact arithmetic:
plus,minus,times(java scale rules) andsetScalewith all
eightRoundingModes. - Value-based
equals/hashCodeconsistent withcompareTo(2.5 == 2.50) — a deliberate
divergence fromjava.math.BigDecimal's scale-sensitive equality. - Special values
NaN,POSITIVE_INFINITY,NEGATIVE_INFINITY(what PostgreSQLnumeric
can emit), ordered and propagated likeDouble. - JVM interop:
toJavaBigDecimal(),BigDecimal.toKormiumDecimal(),RoundingMode.toJavaRoundingMode(). - Differential test suite against
java.math.BigDecimal(seeded, 200k random cases per
suite), parser fuzzing, cross-platform golden suite,explicitApi+ binary-compatibility
validation (JVM + klib).