Function safe_arch::round_m128d_s

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

Rounds $b low as specified, keeps $a high.

let a = m128d::from_array([f64::NAN, 900.0]);
//
let b = m128d::from_array([-0.1, f64::NAN]);
//
assert_eq!(round_m128d_s::<{ round_op!(Nearest) }>(a, b).to_array(), [0.0, 900.0]);
assert_eq!(round_m128d_s::<{ round_op!(NegInf) }>(a, b).to_array(), [-1.0, 900.0]);
//
let b = m128d::from_array([2.4, f64::NAN]);
//
assert_eq!(round_m128d_s::<{ round_op!(PosInf) }>(a, b).to_array(), [3.0, 900.0]);
assert_eq!(round_m128d_s::<{ round_op!(Zero) }>(a, b).to_array(), [2.0, 900.0]);