pub trait Float:
Float
+ Sealed
+ KernelItem
+ Source<Self> {
type Working: Native;
type OrderKey: RadixKey + Key;
// Required methods
fn working(self) -> Self::Working;
fn from_working(t: Self::Working) -> Self;
fn wide(self) -> f64;
fn narrow(x: f64) -> Self;
fn next_up(self) -> Self;
fn next_down(self) -> Self;
fn round_ties_even(self) -> Self;
fn order_key(self) -> Self::OrderKey;
fn total_key(self) -> Self::OrderKey;
fn from_order_key(k: Self::OrderKey) -> Self;
fn choose(
x: Arg<'_, Self>,
y: Arg<'_, Self>,
mask: Arg<'_, Self>,
n: usize,
out: &mut Slots<'_, Self>,
) -> bool;
}Expand description
A float type that rustymath’s functions take: half::f16, f32 or f64.
Required Associated Types§
Required Methods§
Sourcefn from_working(t: Self::Working) -> Self
fn from_working(t: Self::Working) -> Self
t rounded to this type.
Sourcefn next_down(self) -> Self
fn next_down(self) -> Self
The greatest float of this type below self, as f64::next_down gives it.
Sourcefn round_ties_even(self) -> Self
fn round_ties_even(self) -> Self
Rounds to the nearest whole number, with ties to even.
Sourcefn order_key(self) -> Self::OrderKey
fn order_key(self) -> Self::OrderKey
A key whose unsigned order is the order of total_cmp, after ¯0 becomes 0 and every NaN becomes one NaN. So ¯0 and 0 share a key, NaN’s key follows every other, and two floats match exactly when their keys are equal.
Sourcefn total_key(self) -> Self::OrderKey
fn total_key(self) -> Self::OrderKey
A key whose unsigned order is the order of total_cmp, after every NaN becomes positive. So ¯0’s key comes just before 0’s, every NaN’s follows ∞’s, and from_order_key reads the float back exactly, apart from a NaN’s sign. Sorts and selections compare these keys and write floats back from them.
Sourcefn from_order_key(k: Self::OrderKey) -> Self
fn from_order_key(k: Self::OrderKey) -> Self
The float whose order_key or total_key is k. A total key reads back exactly, apart from a NaN’s sign. An order key reads ¯0 back as 0, and every NaN as one NaN.
Sourcefn choose(
x: Arg<'_, Self>,
y: Arg<'_, Self>,
mask: Arg<'_, Self>,
n: usize,
out: &mut Slots<'_, Self>,
) -> bool
fn choose( x: Arg<'_, Self>, y: Arg<'_, Self>, mask: Arg<'_, Self>, n: usize, out: &mut Slots<'_, Self>, ) -> bool
Writes x where mask’s lanes aren’t zero and y where they are into the next n slots of out, through Choose, and gives whether every result succeeded. Fused graphs pass a comparison’s lanes of 1 and 0 as the mask.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".