Merge pull request #97553 from AThousandShips/semantic_equal

[Core] Add `is_same` to types that have float components
This commit is contained in:
Thaddeus Crews
2025-03-10 10:01:05 -05:00
27 changed files with 99 additions and 87 deletions

View File

@@ -593,6 +593,10 @@ public:
return abs(s) < (float)CMP_EPSILON;
}
static _ALWAYS_INLINE_ bool is_same(float a, float b) {
return (a == b) || (is_nan(a) && is_nan(b));
}
static _ALWAYS_INLINE_ bool is_equal_approx(double a, double b) {
// Check for exact equality first, required to handle "infinity" values.
if (a == b) {
@@ -619,6 +623,10 @@ public:
return abs(s) < CMP_EPSILON;
}
static _ALWAYS_INLINE_ bool is_same(double a, double b) {
return (a == b) || (is_nan(a) && is_nan(b));
}
static _ALWAYS_INLINE_ float absf(float g) {
union {
float f;