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                   │  core: conversion, powers, rounding
      └────┬────────┬─────────┬───────┬───────┘
           │        │         │       │       │
  Transcendental  Trig  Hyperbolic  FloatOps  FloatClass
           │        │         │       │       │
      └────┴────────┴─────────┴───────┴───────┘
                         │
                   ┌─────┴─────┐
                   │ RealFull  │  backward-compat supertrait
                   └───────────┘

Traits§

Field
Division ring: everything Num is, plus division and reciprocal.
FloatClass
Floating-point classification.
Hyperbolic
Hyperbolic functions.
Normed
Normed type: has an absolute value satisfying the triangle inequality.
Num
Foundation: anything that can add, subtract, multiply, and has 0/1.
Real
Core real number operations: conversion, powers, rounding, min/max.
RealFull
Backward-compat supertrait combining all sub-traits.
Signed
Signed numbers: negation, absolute value, sign.
Transcendental
Transcendental functions: exp, log, and their variants.
Trig
Trigonometric functions (radians).