Function snappedf
pub fn snappedf(x: f64, step: f64) -> f64Expand description
Returns the multiple of step that is the closest to x. This can also be used to round a floating-point number to an arbitrary number of decimals.
A type-safe version of [method snapped], returning a float.
snappedf(32.0, 2.5) # Returns 32.5
snappedf(3.14159, 0.01) # Returns 3.14