Function safe_arch::round_m128_s

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

Rounds $b low as specified, other lanes use $a.

let a = m128::from_array([f32::NAN, 6.0, 7.0, 8.0]);
//
let b = m128::from_array([-0.1, f32::NAN, f32::NAN, f32::NAN]);
//
assert_eq!(round_m128_s::<{ round_op!(Nearest) }>(a, b).to_array(), [0.0, 6.0, 7.0, 8.0]);
assert_eq!(round_m128_s::<{ round_op!(NegInf) }>(a, b).to_array(), [-1.0, 6.0, 7.0, 8.0]);
//
let b = m128::from_array([2.4, f32::NAN, f32::NAN, f32::NAN]);
//
assert_eq!(round_m128_s::<{ round_op!(PosInf) }>(a, b).to_array(), [3.0, 6.0, 7.0, 8.0]);
assert_eq!(round_m128_s::<{ round_op!(Zero) }>(a, b).to_array(), [2.0, 6.0, 7.0, 8.0]);