From: Steinar H. Gunderson Date: Thu, 20 Mar 2014 21:59:59 +0000 (+0100) Subject: Properly ignore the sign bit when comparing NaNs. X-Git-Tag: 1.1~12^2~13 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=a4d6aa37e11ac3674b0d5cab10437a14557050bb;hp=a5f32397f9c23fa8644fe195865d6c36685cf866 Properly ignore the sign bit when comparing NaNs. Fixes fp16_test test failure on Clang. --- diff --git a/fp16_test.cpp b/fp16_test.cpp index 3deb74b..bb8b182 100644 --- a/fp16_test.cpp +++ b/fp16_test.cpp @@ -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;