[−][src]Trait const_linear::traits::Scalar
A value which has some sensible notion of arithmetic,
a Debug
implementation, and is Copy
. This
trait is sealed, and can not be implemented outside of
const_linear
.
Examples
One and Zero values
use const_linear::traits::Scalar; let x = i32::ZERO; let y = i32::ONE; assert_eq!(x - y, -1);
Converting to floating point
use const_linear::traits::Scalar; assert_eq!(1.to_f64(), 1 as f64); assert_eq!(1.to_f32(), 1 as f32);
Associated Constants
const ZERO: Self
The "zero" value for this Scalar type. Acts as the additive identity.
const ONE: Self
The "one" value for this Scalar type. Acts as the multiplicative identity.
Required methods
fn to_f64(self) -> f64
Converts T
to an f64
. Equivalent to T as f64
.
fn to_f32(self) -> f32
Converts T
to an f32
. Equivalent to T as f32
.