]> git.sesse.net Git - movit/commitdiff
Properly ignore the sign bit when comparing NaNs.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 20 Mar 2014 21:59:59 +0000 (22:59 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 20 Mar 2014 22:08:31 +0000 (23:08 +0100)
Fixes fp16_test test failure on Clang.

fp16_test.cpp

index 3deb74b32a9f3e3c5dec92807cec8aa08a01eea9..bb8b18280d1f487889680d307286c476403cb5f8 100644 (file)
@@ -41,7 +41,8 @@ union fp32 {
 };
 
 TEST(FP16Test, NaN) {
-       EXPECT_EQ(0xfe00, fp64_to_fp16(0.0 / 0.0));
+       // Ignore the sign bit.
+       EXPECT_EQ(0x7e00, fp64_to_fp16(0.0 / 0.0) & 0x7fff);
        EXPECT_TRUE(isnan(fp16_to_fp64(0xfe00)));
 
        fp64 borderline_inf;