Arithmetic Documentation
This directory contains the English documentation baseline for arithmetic 0.2.1.
Core Documents
- Package README: ./README.md
Surface Summary
- Algebra remains in
luna-generic. arithmeticprovides function capabilities, not a bundled “real number” abstraction.FloatandDoubleinstances live in the root package and callKaida-Amethyst/mathdirectly.BigIntand the integer family provide only exact capability impls such as integerPower.- These floating-point instances use
Kaida-Amethyst/mathas their backend. - The package does not model ordering, topology, branch cuts, or principal-value semantics.
Capability Layers
- Unchecked elementary traits remain available for native scalars and similar context-free backends.
- Checked/contextual traits return
Result[Self, ArithmeticError]and takeArithmeticContext. - Enclosure traits model containment and overlap relations without forcing a fake scalar total order.
Semantic Notes
- Public traits preserve the concrete
Selftype instead of widening to helper result types. - Domain validity remains part of the caller contract unless an instance explicitly documents stronger behavior.
- Floating-point instances inherit edge-value and branch semantics from
Kaida-Amethyst/math. - Integer-family support is intentionally narrower and only covers capabilities that remain closed on those types.
arithmeticis a capability-boundary package and does not define calculus, matrices, complex numbers, symbolic algebra, or special-function layers.
Power Preconditions
Power::powis shared across floating and integer families, but not every instance accepts the same argument space.BigInt,Int,Int16, andInt64require a non-negative exponent.- Passing a negative exponent to those signed integer-family instances aborts at runtime.
UInt,UInt16, andUInt64avoid that specific precondition because their exponent type is already non-negative.- This package documents the preconditions, but selecting mathematically valid arguments remains partly the caller's responsibility.
PowNatCheckedandPowIntCheckedsplit integer-exponent power into checked capability boundaries.- In this checked layer,
x^0returns one, including0^0.