diff --git a/test_conformance/basic/test_fpmath.cpp b/test_conformance/basic/test_fpmath.cpp index 77247bba..fc7b9108 100644 --- a/test_conformance/basic/test_fpmath.cpp +++ b/test_conformance/basic/test_fpmath.cpp @@ -98,14 +98,20 @@ int verify_fp(std::vector (&input)[2], std::vector &output, auto &inB = input[1]; for (size_t i = 0; i < output.size(); i++) { - bool nan_test = false; - T r = test.ref(inA[i], inB[i]); + bool both_nan = false; if (std::is_same::value) - nan_test = !(isHalfNan(r) && isHalfNan(output[i])); + { + both_nan = isHalfNan(r) && isHalfNan(output[i]); + } + else if (std::is_floating_point::value) + { + both_nan = std::isnan(r) && std::isnan(output[i]); + } - if (r != output[i] && nan_test) + // If not both nan, check if the result is the same + if (!both_nan && (r != output[i])) { log_error("FP math test for type: %s, vec size: %zu, failed at " "index %zu, %a '%c' %a, expected %a, get %a\n",