Trait kodama::Float

source ·
pub trait Float: Sealed + Copy + Clone + PartialEq + PartialOrd + Add<Self, Output = Self> + Sub<Self, Output = Self> + Div<Self, Output = Self> + Mul<Self, Output = Self> {
    fn from_usize(v: usize) -> Self;
    fn from_float<F: Float>(v: F) -> Self;
    fn to_f64(self) -> f64;
    fn infinity() -> Self;
    fn max_value() -> Self;
    fn sqrt(self) -> Self;
    fn abs(self) -> Self;
}
Expand description

A trait for writing generic code over floating point numbers.

We used to use the corresponding trait from the num-traits crate, but for operational simplicity, we provide our own trait to avoid the dependency.

This trait is sealed. Callers therefore can not implement it. It is only implemented for the f32 and f64 types.

Required Methods§

Converts a usize to a float.

Converts any floating type to this one.

Converts this floating type to a f64.

Returns the representation of “infinity” for this float type.

Returns the maximum value for this float type.

Returns the square root.

Returns the absolute value.

Implementations on Foreign Types§

Implementors§