A generic interface for casting between machine scalars with the
as operator, which admits narrowing and precision loss.
Implementers of this trait AsPrimitive should behave like a primitive
numeric type (e.g. a newtype around another primitive), and the
intended conversion must never fail.
Float requires the in-place arithmetic operators (+=, -=, *=, /=) in
addition to the by-value ones from Num. Every real floating-point type supports
them, and they let the algebra tower derive AddMonoid/Field/Real/… for any
T: Float — so a new float type implements Float and inherits the whole tower
through the blanket impls (impl<T: Float> Real for T, etc.).
A value with a real modulus and real scaling: the bridge that lets generic code treat a real
(f64) and a complex (Complex<f64>) uniformly for norm work.
An analytic real scalar: commutative-ring arithmetic plus the elementary
functions, constants, ordering, rounding, and exceptional-value predicates of
the real numbers — without field invertibility.
Scalar sits in the real tower between Real and
RealField: it adds division to Real but, unlike a field, does not
require a total inverse. That is deliberate, so that Dual qualifies — its ε
component is a zero divisor, so it has division yet is not a field. The
deep_causality_calculus crate writes its differentiation and integration operators against
Scalar, so a single model evaluates at f64 (the value) and at Dual (the derivative).