pub fn snap<T: Real>(x: T, step_size: T) -> TExpand description
Snap x to the nearest multiple of step.
ยงExamples
use mathverse_core::ops::snap;
assert_eq!(snap(7.0, 5.0), 5.0);
assert_eq!(snap(8.0, 5.0), 10.0);
assert_eq!(snap(0.0, 3.0), 0.0);