Function glm::builtin::roundEven
[−]
[src]
pub fn roundEven<F: BaseFloat, T: GenFloat<F>>(x: T) -> T
Returns a value equal to the nearest integer to x
.
A fractional part of 0.5
will round toward the nearest even integer.
(Both 3.5
and 4.5
for x will return 4.0
.)
Example
use glm::{ roundEven, vec4 }; assert_eq!(roundEven(2.5_f32), 2.); assert_eq!(roundEven(1.5_f32), 2.); assert_eq!(roundEven(vec4(3.14, -3.14, -1.5, -2.5)), vec4(3., -3., -2., -2.));