Function glm::builtin::abs [] [src]

pub fn abs<S: SignedNum + BaseNum, T: GenNum<S>>(x: T) -> T

Returns x if x ≥ 0, otherwise it returns –x.

Example

use glm::{ abs, dvec4, SignedNum };

assert_eq!(abs(-1_f32), 1.);
let v4 = dvec4(0., 100., -2., -3.);
assert_eq!(abs(v4), v4.abs());
assert_eq!(abs(v4), dvec4(0., 100., 2., 3.));