Skip to main content

Maximum

Trait Maximum 

Source
pub trait Maximum: Sized {
    type Output;

    // Required method
    fn maximum(self, other: Self) -> Self::Output;
}
Expand description

IEEE 754-2019 maximum (NaN-propagating, unlike max).

Required Associated Types§

Source

type Output

Returns the greater of two numbers, propagating NaN and treating +0.0 as greater than -0.0 — the IEEE 754-2019 maximum operation, in contrast to max which ignores NaN.

use const_num_traits::Maximum;

assert_eq!(Maximum::maximum(1.0f32, 2.0), 2.0);
assert!(Maximum::maximum(1.0f32, f32::NAN).is_nan());

Required Methods§

Source

fn maximum(self, other: Self) -> Self::Output

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Maximum for f32

Source§

type Output = f32

Source§

fn maximum(self, other: Self) -> f32

Source§

impl Maximum for f64

Source§

type Output = f64

Source§

fn maximum(self, other: Self) -> f64

Implementors§