Fixed issue in testing where the test for qnan was wrong.

PiperOrigin-RevId: 656497631
Change-Id: I976ec591bbc500908f319da70624b0a8a2ebd8cf
diff --git a/riscv/test/riscv_fp_test_base.h b/riscv/test/riscv_fp_test_base.h
index 08e14e2..45d9504 100644
--- a/riscv/test/riscv_fp_test_base.h
+++ b/riscv/test/riscv_fp_test_base.h
@@ -94,7 +94,8 @@
   static const IntType kCanonicalNaN = 0x7fc0'0000ULL;
   static bool IsNaN(T value) { return std::isnan(value); }
   static bool IsQNaN(T value) {
-    return *reinterpret_cast<IntType *>(&value) == kQNaN;
+    IntType uint_val = *reinterpret_cast<IntType *>(&value);
+    return IsNaN(value) && (((1ULL << (kSigSize - 1)) & uint_val) != 0);
   }
 };
 
@@ -120,7 +121,8 @@
   static const IntType kCanonicalNaN = 0x7ff8'0000'0000'0000ULL;
   static bool IsNaN(T value) { return std::isnan(value); }
   static bool IsQNaN(T value) {
-    return *reinterpret_cast<IntType *>(&value) == kQNaN;
+    IntType uint_val = *reinterpret_cast<IntType *>(&value);
+    return IsNaN(value) && (((1ULL << (kSigSize - 1)) & uint_val) != 0);
   }
 };