Describe the bug, including details regarding any error messages, version, and platform.
In the code below, two NaN values are considered equal regardless of whetherEqualOptions::nan_equalis set to true or false. The root of the problem lies here, where float16 values with the same memory representation are not correctly handled, and also here, where HalfFloat is implemented as a uint16_t, causing the comparison to return true.
TEST(FloatComparasion, Float16NaN) {
auto half_float_array = ArrayFromJSON(float16(), R"([16.0,NaN])");
auto half_float_array_1 = ArrayFromJSON(float16(), R"([16.0,NaN])");
ASSERT_TRUE(half_float_array->Equals(half_float_array_1, EqualOptions::Defaults().nans_equal(false)));
ASSERT_TRUE(half_float_array->Equals(half_float_array, EqualOptions::Defaults().nans_equal(false)));
}Component(s)
C++
Describe the bug, including details regarding any error messages, version, and platform.
In the code below, two
NaNvalues are considered equal regardless of whetherEqualOptions::nan_equalis set totrueorfalse. The root of the problem lies here, wherefloat16values with the same memory representation are not correctly handled, and also here, whereHalfFloatis implemented as auint16_t, causing the comparison to returntrue.Component(s)
C++