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

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));

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));

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));

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));

Implementors