Function glm::builtin::sign [] [src]

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

Returns 1.0 if x > 0, 0.0 if x = 0, or –1.0 if x < 0.

Example

use glm::{ sign, vec3 };

assert_eq!(sign(-0_f32), 0.);
assert_eq!(sign(vec3(-100., 2., 0.)), vec3(-1., 1., 0.));