Skip to main content

clampf

Function clampf 

pub fn clampf(value: f64, min: f64, max: f64) -> f64
Expand description

Clamps the value, returning a float not less than min and not more than max.

var speed = 42.1
var a = clampf(speed, 1.0, 20.5) # a is 20.5

speed = -10.0
var b = clampf(speed, -1.0, 1.0) # b is -1.0