Function babalcore::boxcar [−][src]
pub fn boxcar(x: f64) -> f64
Boxcar function as defined here: https://en.wikipedia.org/wiki/Boxcar_function With A=1, a=0, b=1, so it is 0 if x<0, 1 if x>0 and x<1 an 1 if x>1.
Examples
use babalcore::*; assert_eq!(0.0, boxcar(-0.5)); assert_eq!(0.5, boxcar(0.0)); assert_eq!(1.0, boxcar(0.5)); assert_eq!(0.5, boxcar(1.0)); assert_eq!(0.0, boxcar(1.5));