Function gdnative_core::globalscope::stepify
source · [−]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);