Expand description
Const-friendly numeric traits for expressing ranges, signs, constants, and
basic operations at the type level. Designed to stay lightweight and usable
in no_std contexts.
Modules§
Traits§
- Abs
- Absolute value helper.
- Acos
- Arccosine helper.
- AnySign
- Marker trait for types that can represent both negative and positive values (including zero). Implementers must ensure the type’s domain includes negative, zero, and positive values.
- AnySign
Infinity - Provides an unsigned infinity value via a method.
- AnySign
Infinity Const - Provides an unsigned infinity constant.
- Asin
- Arcsine helper.
- Atan
- Arctangent helper.
- Atan2
- Two-argument arctangent helper.
- Cbrt
- Cube root helper.
- Ceil
- Ceil helper.
- Checked
Add - Supplies a checked addition that returns
Noneon overflow. - Checked
Div - Supplies a checked division that returns
Noneon division by zero or overflow. - Checked
Mul - Supplies a checked multiplication that returns
Noneon overflow. - Checked
Neg - Supplies a checked negation that returns
Noneon overflow. - Checked
Rem - Supplies a checked remainder that returns
Noneon division by zero. - Checked
Sub - Supplies a checked subtraction that returns
Noneon underflow/overflow. - Clamp
- Supplies a
clamphelper for numeric types. - Cos
- Cosine helper.
- Epsilon
- Provides machine epsilon as a method.
- Epsilon
Const - Provides machine epsilon as an associated constant.
- Exp
- Exponential helper.
- Floor
- Floor helper.
- HasAny
Sign Infinity - Marker for types that can represent (any) infinity. Implementers must ensure positive or negative infinity is representable.
- HasEpsilon
- Marker for types that can represent machine epsilon. Implementers must ensure an epsilon value is representable.
- HasMax
Value - Marker for types that can represent a maximum value. Implementers must ensure a well-defined maximum value exists.
- HasMin
Value - Marker for types that can represent a minimum value. Implementers must ensure a well-defined minimum value exists.
- HasNan
- Marker for types that can represent NaN. Implementers must ensure NaN is representable.
- HasNegative
Infinity - Marker for types that can represent negative infinity. Implementers must ensure negative infinity is representable.
- HasOne
- Marker for types that can represent one. Implementers must ensure one is representable.
- HasPositive
Infinity - Marker for types that can represent positive infinity. Implementers must ensure positive infinity is representable.
- HasTwo
- Marker for types that can represent two. Implementers must ensure two is representable.
- HasZero
- Marker for types that can represent zero. Implementers must ensure zero is representable.
- Hypot
- Hypotenuse helper.
- Log
- Natural logarithm helper.
- Log2
- Base-2 logarithm helper.
- Log10
- Base-10 logarithm helper.
- LogBase
- Logarithm with arbitrary base.
- MaxValue
- Provides the largest representable value for the type.
- MaxValue
Const - Provides the largest representable value for the type as a constant.
- MinValue
- Provides the smallest representable value for the type.
- MinValue
Const - Provides the smallest representable value for the type as a constant.
- Nan
- Provides a NaN value via a method.
- NanConst
- Provides a NaN value as an associated constant.
- Negative
- Marker trait for types that guarantee values strictly less than zero.
Implementers must ensure all inhabited values are
< 0. - Negative
Infinity - Provides a negative infinity value via a method.
- Negative
Infinity Const - Provides a negative infinity constant.
- NonAny
Sign Infinity - Marker for types that cannot represent infinity (positive or negative). Implementers must ensure infinities cannot be produced or represented.
- NonEpsilon
- Marker for types that do not expose a meaningful epsilon. Implementers must ensure an epsilon value is not provided or meaningful.
- NonMax
Value - Marker for types that do not expose a meaningful maximum value. Implementers must ensure no well-defined maximum value is provided.
- NonMin
Value - Marker for types that do not expose a meaningful minimum value. Implementers must ensure no well-defined minimum value is provided.
- NonNan
- Marker for types that cannot represent NaN. Implementers must ensure NaN cannot be produced or represented.
- NonNegative
- Marker trait for types that guarantee values are greater than or equal to zero.
Implementers must ensure all inhabited values are
>= 0. - NonNegative
Infinity - Marker for types that cannot represent negative infinity. Implementers must ensure negative infinity cannot be produced or represented.
- NonPositive
- Marker trait for types that guarantee values are less than or equal to zero.
Implementers must ensure all inhabited values are
<= 0. - NonPositive
Infinity - Marker for types that cannot represent positive infinity. Implementers must ensure positive infinity cannot be produced or represented.
- One
- Provides the multiplicative identity (
1) as a method. - OneConst
- Provides the multiplicative identity (
1) as an associated constant. - Positive
- Marker trait for types that guarantee values strictly greater than zero.
Implementers must ensure all inhabited values are
> 0. - Positive
Infinity - Provides a positive infinity value via a method.
- Positive
Infinity Const - Provides a positive infinity constant.
- Pow
- Exponentiation helper.
- Reciprocal
- Provides a multiplicative inverse operation for numeric types.
- Root
- Nth root helper.
- Round
- Round-to-nearest helper.
- Saturating
Add - Supplies a saturating addition.
- Saturating
Mul - Supplies a saturating multiplication.
- Saturating
Sub - Supplies a saturating subtraction.
- Signum
- Returns the sign of a value.
- Sin
- Sine helper.
- Sqrt
- Square root helper.
- Tan
- Tangent helper.
- Trunc
- Truncate toward zero.
- Two
- Provides the value
2as a method. - TwoConst
- Provides the value
2as an associated constant. - Zero
- Provides the additive identity (
0) as a method. - Zero
Const - Provides the additive identity (
0) as an associated constant.