Function datafusion_common::rounding::next_down

source ·
pub fn next_down<F: FloatBits + Copy>(float: F) -> F
Expand description

Returns the next representable floating-point value smaller than the input value.

This function takes a floating-point value that implements the FloatBits trait, calculates the next representable value smaller than the input, and returns it.

If the input value is NaN or negative infinity, the function returns the input value.

§Examples

use datafusion_common::rounding::next_down;

let f: f32 = 1.0;
let next_f = next_down(f);
assert_eq!(next_f, 0.99999994);