@@ -1172,7 +1172,7 @@ static f32x4 normalize3(f32x4 v) noexcept
11721172}
11731173
11741174/* *
1175- * @brief Returns true if SIMD vector is normalized with specified tolerance.
1175+ * @brief Returns true if 4D SIMD vector is normalized with specified tolerance.
11761176 *
11771177 * @param v target SIMD vector to check
11781178 * @param tolerance floating point precision tolerance
@@ -1182,7 +1182,7 @@ static bool isNormalized4(f32x4 v, float tolerance = 1.0e-6f) noexcept
11821182 return std::abs (lengthSq4 (v) - 1 .0f ) <= tolerance;
11831183}
11841184/* *
1185- * @brief Returns true if SIMD vector is normalized with specified tolerance.
1185+ * @brief Returns true if 3D SIMD vector is normalized with specified tolerance.
11861186 *
11871187 * @param v target SIMD vector to check
11881188 * @param tolerance floating point precision tolerance
@@ -1192,6 +1192,36 @@ static bool isNormalized3(f32x4 v, float tolerance = 1.0e-6f) noexcept
11921192 return std::abs (lengthSq3 (v) - 1 .0f ) <= tolerance;
11931193}
11941194
1195+ /* *
1196+ * @brief Returns true if any SIMD vector element is not a number.
1197+ * @param v target SIMD vector to check
1198+ */
1199+ static bool isNan4 (f32x4 v) noexcept
1200+ {
1201+ #if defined(MATH_SIMD_SUPPORT_SSE)
1202+ return _mm_movemask_ps (_mm_cmpunord_ps (v.data , v.data )) != 0 ;
1203+ #elif defined(MATH_SIMD_SUPPORT_NEON)
1204+ return vaddvq_u32 (vshrq_n_u32 (vceqq_f32 (v.data , v.data ), 31 )) != 4 ;
1205+ #else
1206+ return isNan ((float4)v);
1207+ #endif
1208+ }
1209+ /* *
1210+ * @brief Returns true if any SIMD vector element is not a number.
1211+ * @param v target SIMD vector to check
1212+ */
1213+ static bool isNan3 (f32x4 v) noexcept
1214+ {
1215+ #if defined(MATH_SIMD_SUPPORT_SSE)
1216+ return (_mm_movemask_ps (_mm_cmpunord_ps (v.data , v.data )) & 0x7 ) != 0 ;
1217+ #elif defined(MATH_SIMD_SUPPORT_NEON)
1218+ auto mask = (uint32x4_t ){ 1 , 1 , 1 , 0 };
1219+ return vaddvq_u32 (vandq_u32 (vceqq_f32 (v.data , v.data ), mask)) != 3 ;
1220+ #else
1221+ return isNan ((float3)v);
1222+ #endif
1223+ }
1224+
11951225/* **********************************************************************************************************************
11961226 * @brief Returns float remainder of numer/denom for each element of the SIMD vector.
11971227 *
0 commit comments