clamp_min in num_traits - Rust
Description: A value bounded by a minimum value
Keywords: rust, rustlang, rust-lang, clamp_min

# Function num_traits::clamp_min

source ·

    pub fn clamp_min<T: PartialOrd>(input: T, min: T) -> T

Expand description

A value bounded by a minimum value

If input is less than min then this returns min. Otherwise this returns input. `clamp_min(std::f32::NAN, 1.0)` preserves `NAN` different from `f32::min(std::f32::NAN, 1.0)`.

Panics in debug mode if `!(min == min)`. (This occurs if `min` is `NAN`.)