Trait faster::intrin::PackedRound
[−]
[src]
pub trait PackedRound { fn round(&self) -> Self; fn ceil(&self) -> Self; fn floor(&self) -> Self; fn trunc(&self) -> Self; }
Required Methods
fn round(&self) -> Self
Return a vector with all elements of self
rounded to the nearest
integer.
extern crate faster; use faster::*; assert_eq!(f32s(2.7).round(), f32s(3.0)); assert_eq!(f32s(2.4).round(), f32s(2.0)); assert_eq!(f32s(-2.7).round(), f32s(-3.0)); assert_eq!(f32s(-2.4).round(), f32s(-2.0));
fn ceil(&self) -> Self
Return a vector with all elements of self
rounded up to the nearest
integer.
extern crate faster; use faster::*; assert_eq!(f32s(2.7).ceil(), f32s(3.0)); assert_eq!(f32s(2.4).ceil(), f32s(3.0)); assert_eq!(f32s(-2.7).ceil(), f32s(-2.0)); assert_eq!(f32s(-2.4).ceil(), f32s(-2.0));
fn floor(&self) -> Self
Return a vector with all elements of self
rounded down to the nearest
integer.
extern crate faster; use faster::*; assert_eq!(f32s(2.7).floor(), f32s(2.0)); assert_eq!(f32s(2.4).floor(), f32s(2.0)); assert_eq!(f32s(-2.7).floor(), f32s(-3.0)); assert_eq!(f32s(-2.4).floor(), f32s(-3.0));
fn trunc(&self) -> Self
Return a vector with all elements of self
truncated. Effectively
rounds the elements towards zero.
extern crate faster; use faster::*; assert_eq!(f32s(2.7).trunc(), f32s(2.0)); assert_eq!(f32s(2.4).trunc(), f32s(2.0)); assert_eq!(f32s(-2.7).trunc(), f32s(-2.0)); assert_eq!(f32s(-2.4).trunc(), f32s(-2.0));