Skip to content

Commit 48bd3e9

Browse files
authored
Use FloatEquals on one remaining float equality test (KhronosGroup#6783)
This accommodates environments that warn on float point equality comparisons.
1 parent 87a678a commit 48bd3e9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

source/util/hex_float.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,8 @@ class HexFloat {
13241324
}
13251325
other_int_type rounded = static_cast<other_int_type>(std::round(d));
13261326
other.set_value(static_cast<other_uint_type>(rounded));
1327-
return (d - rounded) == 0 ? CastResult::Success : CastResult::LostPrecision;
1327+
return FloatEquals(d - rounded, 0.0) ? CastResult::Success
1328+
: CastResult::LostPrecision;
13281329
}
13291330

13301331
private:

0 commit comments

Comments
 (0)