Function safe_arch::round_m128

source ·
pub fn round_m128<const MODE: i32>(a: m128) -> m128
Available with target feature sse4.1 only.
Expand description

Rounds each lane in the style specified.

let a = m128::from_array([-0.1, 1.6, 3.3, 4.5]);
//
assert_eq!(round_m128::<{ round_op!(Nearest) }>(a).to_array(), [0.0, 2.0, 3.0, 4.0]);
//
assert_eq!(round_m128::<{ round_op!(NegInf) }>(a).to_array(), [-1.0, 1.0, 3.0, 4.0]);
//
assert_eq!(round_m128::<{ round_op!(PosInf) }>(a).to_array(), [0.0, 2.0, 4.0, 5.0]);
//
assert_eq!(round_m128::<{ round_op!(Zero) }>(a).to_array(), [0.0, 1.0, 3.0, 4.0]);