Clarify rounding of SIMD round
GMX_EXPECT_SIMD_REAL_EQ(setSimdRealFrom1R(3), round(setSimdRealFrom1R(2.5)));to SimdFloatingpointTest,round fails on AVX. The doxygen of round should specify what happens with ties (to zero (like c++), to even (like IEEE), depending on rounding mode set by user (like current AVX implementation), or undefined). And there should be a test which checks for ties (unless undefined).
#1 Updated by Erik Lindahl over 2 years ago
I don't think we can (or at least want to) require a specific rounding mode.
While the vast majority uses IEEE, there have been some platforms (IBM Power with VMX or VSX SIMD) that used non-standard rounding either for round() or the float-to-integer-conversions. For this reason (and our exp() implementations, the only thing we require is that those to two rounding functionalities use the same rounding mode - which will make sure the algorithms produce correct results.
The main concern is that the float-to-integer conversion is needed for tables in the most performance-sensitive loop of the entire program, and requiring any rounding mode that isn't natively supported on a specific platform could lead to a very large performance hit.