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

Snaps float value s to a given step.

This can also be used to round a floating point number to an arbitrary number of decimals.

use gdnative::globalscope::*;
use std::f32::consts::E; // Euler constant, 2.71828

assert_eq!(stepify(100.0, 32.0), 96.0);
assert_eq!(stepify(E, 0.01), 2.72);