Function datafusion::common::rounding::next_down

source ·
pub fn next_down<F>(float: F) -> F
where F: FloatBits + Copy,
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);