Skip to main content

Module traits

Module traits 

Source
Expand description

Numeric abstraction traits.

Every MathVerse crate is generic over these traits. The hierarchy is:

                        ┌─────────┐
                        │   Num   │   Integer + Float
                        └────┬────┘
                             │
                    ┌────────┴────────┐
                    │                 │
               ┌────┴────┐     ┌─────┴─────┐
               │ Signed  │     │ Unsigned* │  (*marker, not enforced)
               └────┬────┘     └───────────┘
                    │
           ┌────────┴────────┐
           │                 │
      ┌────┴────┐     ┌──────┴──────┐
      │  Field  │     │   (marker)  │
      └────┬────┘     └─────────────┘
           │
      ┌────┴────┐
      │  Real   │   f32 / f64 blanket impl
      └─────────┘

Traits§

Field
Division ring: everything Num is, plus division and reciprocal.
Normed
Normed type: has an absolute value satisfying the triangle inequality.
Num
Foundation: anything that can add, subtract, multiply, and has 0/1.
Real
Real numbers: transcendental functions, powers, rounding, classification.
Signed
Signed numbers: negation, absolute value, sign.