Function glm::builtin::round [] [src]

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

Returns a value equal to the nearest integer to x.

The fraction 0.5 will round in a direction chosen by the implementation, presumably the direction that is fastest. This includes the possibility that round(x) returns the same value as roundEven(x) for all values of x.

Example

use glm::{ round, vec3 };

assert_eq!(round(-3.14_f32), -3.);
assert_eq!(round(vec3(-1.7, 4., 4.9)), vec3(-2., 4., 5.));