Function glm::builtin::modf [] [src]

pub fn modf<F: BaseFloat, T: GenFloat<F>>(x: T) -> (T, T)

Returns the fractional and integer parts of x.

Both parts will have the same sign as x.

Note

In GLSL, the integer part is returned via a output parameter i. In Rust we can return both parts using a tuple (interger part, fractional part).

Example

use glm::{ modf, vec3 };

assert_eq!(modf(1.5_f32), (1., 0.5));
assert_eq!(modf(vec3(0., -1.25, 3.75)), (vec3(0., -1., 3.), vec3(0., -0.25, 0.75)));