diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-07-11 10:12:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 17:12:17 +0000 |
| commit | 57567778b7d91afe7e6325c731d54b313b8b16e9 (patch) | |
| tree | 7fbd665e6ed71680ab68b21571e84f40bab16fb5 /source/core | |
| parent | b20b9297ed20f85dec6212cad83eeacaecbaccf3 (diff) | |
Fix IEEE 754 NaN comparisons in constant folding (#7721)
* Fix IEEE 754 NaN comparisons in constant folding
Added proper NaN handling in SCCP optimization pass to follow IEEE 754 standard:
- NaN \!= any value returns true
- All other NaN comparisons return false
- Added double precision NaN detection support
- Fixed type detection to check operands instead of result type
* Avoid differentiating NaN and non-NaN cases
* format code (#76)
---------
Co-authored-by: slangbot <ellieh+slangbot@nvidia.com>
Diffstat (limited to 'source/core')
| -rw-r--r-- | source/core/slang-math.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/core/slang-math.h b/source/core/slang-math.h index e977dc37d..c7e77fce5 100644 --- a/source/core/slang-math.h +++ b/source/core/slang-math.h @@ -106,8 +106,10 @@ public: } static inline int IsNaN(float x) { return std::isnan(x); } + static inline int IsNaN(double x) { return std::isnan(x); } static inline int IsInf(float x) { return std::isinf(x); } + static inline int IsInf(double x) { return std::isinf(x); } static inline unsigned int Ones32(unsigned int x) { |
