mirror of
https://github.com/godotengine/godot.git
synced 2026-02-07 19:32:36 +00:00
Merge pull request #97553 from AThousandShips/semantic_equal
[Core] Add `is_same` to types that have float components
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user