Function veloren_voxygen::hud::multiplier_to_percentage

source ·
pub fn multiplier_to_percentage(value: f32) -> f32
Expand description

Converts multiplier to percentage. NOTE: floats are not the most precise type.

§Examples

use veloren_voxygen::hud::multiplier_to_percentage;

let positive = multiplier_to_percentage(1.05);
assert!((positive - 5.0).abs() < 0.0001);
let negative = multiplier_to_percentage(0.85);
assert!((negative - (-15.0)).abs() < 0.0001);