quantize

Function quantize 

Source
pub fn quantize(value: f32, step: f32) -> f32
Expand description

Quantizes value to the nearest multiple of step.

Useful for rounding or grid alignment of continuous values.

§Panics

Panics if step is not positive.

§Example

use math2::quantize;
assert_eq!(quantize(15.0, 10.0), 20.0);