Note on the new defaults
The new decimal128 defaults are more than sufficient for currency and
other real-world numeric use cases. With precision: 34 and a scale of
2 (two digits after the decimal point for cents), values from 0.00 up
to roughly 99_999_999_999_999_999_999_999_999_999_999.99 (~10³², 100
nonillion) round-trip without rounding. Most upgrades from 2.x require
no code changes.
Security
- Make the v2.4.0 mitigations for CVE-2026-32686 the default. The
defaultDecimal.Contextand the public parse, cast, and to_string
functions now follow IEEE 754 decimal128 limits, rejecting inputs
such as1e1000000000without materializing them.
Breaking changes
Decimal.Contextdefaults change from precision28and unbounded
emax/eminto decimal128 values:precision: 34,emax: 6_144,
emin: -6_143. Operation results whose adjusted exponent leaves that
band signal overflow or underflow.Decimal.parse/1andDecimal.cast/1reject inputs whose digit count
exceeds34(decimal128 precision) or whose absolute exponent exceeds
6_144(decimal128 emax). Useparse/2/cast/2with
max_digits: :infinityandmax_exponent: :infinityto restore
unbounded behavior.Decimal.parse/2andDecimal.cast/2default:max_digitsto34
and:max_exponentto6_144when not specified.Decimal.to_string/2andDecimal.to_string/3raiseArgumentError
when the rendered output would exceed6_178digit characters
(precision + emax — the worst-case:normalwidth of any in-range
decimal128 value).Inspect,String.Chars, andJSON.Encoder
protocol implementations passmax_digits: :infinityso debug output
always succeeds.