Arithmetic Documentation
This directory contains the English documentation baseline for arithmetic0.5.0. Earlier release history lives in CHANGELOG.md.
Release Focus
IntegralContextualembeds MoonBitIntvalues and returns diagnostics.AdjacentContextualexposes next-plus, next-minus, and next-toward.ConstantsContextualandHyperbolicContextualdefine context-faithful capability boundaries for richer numeric backends.- Certification failures remain explicit through
ArithmeticError.
Capability Layers
- Unchecked elementary traits expose direct backend behavior.
- Checked traits expose structured domain and division failures.
- Contextual traits return a value plus diagnostics under an explicit
ArithmeticContext. - Enclosure traits model containment and definite or possible relations.
Context Contract
- Precision is clamped to at least
1. e_minmust not exceede_maxwhen both are supplied.- Decimal presets define precision, exponent range, and clamping together.
- Diagnostics combine with logical OR and remain ordinary immutable values.
Built-in Instance Limits
The built-in Float and Double contextual operations preserve native scalar behavior. They do not apply arbitrary decimal precision, directed rounding, exponent clamping, or general status-flag detection. Float integer embedding reports detectable conversion loss; adjacent operations use the fixed IEEE binary format and return empty diagnostics because neighbor selection is exact. Contextual division and square root reuse the checked validation paths. Native Float and Double do not implement contextual constants or hyperbolic functions.