core API
Purpose
arithmetic extends luna-generic with analytic capabilities. It models callable traits such as square root, logarithm, and trigonometric functions, plus checked/contextual arithmetic boundaries.
Unchecked capability traits
Sqrt,Cbrt,RadicalExponentialLogarithmicPowerTrigonometric,InverseTrigonometricHyperbolic,InverseHyperbolicConstants
These are defined in src/elementary.mbt.
Checked and contextual surface
Shared types
FpClassRoundingModeArithmeticContextArithmeticErrorKindArithmeticError
Checked traits
SqrtCheckedDivCheckedCompareCheckedPowNatCheckedPowIntCheckedParseChecked
Enclosure relations
ContainsOverlapsDefinitelyLtDefinitelyLeMaybeEq
These are defined in src/checked.mbt.
Shipped instances
FloatandDoubleimplement the broad elementary surface throughKaida-Amethyst/math.FloatandDoublealso implementsqrt_checked,div_checked,compare_checked,pow_nat_checked, andpow_int_checked.BigIntand the integer family implement the narrower exact subset, most notably integerPower.
Semantic notes
- Unchecked traits leave domain restrictions and branch semantics to the concrete instance.
- On signed integers and
BigInt,Powerrequires a non-negative exponent; negative exponents abort at runtime. ArithmeticContext::newclamps precision to at least1.PowNatCheckedtreatsx^0as the multiplicative identity, including0^0.- Enclosure traits are relations, not a fake total order.