Module astral_math::num

Expand description

Additional functionality for numerics.

This module provides traits that are useful when doing numerical work. See the individual documentation for each piece for more information.

Traits

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.
Numbers which have upper and lower bounds
Functions for primitive type, which has a non-zero correspondant.
The base trait for numeric types, covering 0 and 1 values, comparisons, basic numeric operations, and string conversion.
An interface for casting between machine scalars.
Generic trait for types implementing basic numeric operations
Defines a multiplicative identity element for Self.
Generic trait for primitive integers.
Functions for primitive unsigned integral types.
Saturating math operations. Deprecated, use SaturatingAdd, SaturatingSub and SaturatingMul instead.
Useful functions for signed numbers (i.e. numbers that can be negative).
A trait for values which cannot be negative
Performs addition that wraps around on overflow.
Performs multiplication that wraps around on overflow.
Performs a left shift that does not panic.
Performs a right shift that does not panic.
Performs subtraction that wraps around on overflow.
Defines an additive identity element for Self.