pub fn sign(x: f64) -> f64
Expand description
Implements the sign function
│ -1 if x < 0
sign(x) = ┤ 0 if x = 0
│ 1 if x > 0
|x| x
sign(x) = ——— = ———
x |x|
sign(x) = 2 · heaviside(x) - 1
Reference: https://en.wikipedia.org/wiki/Sign_function