Function emath::smart_aim::best_in_range_f64
source · pub fn best_in_range_f64(min: f64, max: f64) -> f64Expand description
Find the “simplest” number in a closed range [min, max], i.e. the one with the fewest decimal digits.
So in the range [0.83, 1.354] you will get 1.0, and for [0.37, 0.48] you will get 0.4.
This is used when dragging sliders etc to get the values that users are most likely to desire.
This assumes a decimal centric user.