Skip to content

Commit ce065f9

Browse files
committed
GPU: Add IsNaN to CAMath
1 parent c5209b1 commit ce065f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

GPU/Common/GPUCommonMath.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class GPUCommonMath
8282
GPUd() static int32_t Float2IntRn(float x);
8383
GPUd() static float Modf(float x, float y);
8484
GPUd() static bool Finite(float x);
85+
GPUd() static bool IsNaN(float x);
8586
GPUd() static uint32_t Clz(uint32_t val);
8687
GPUd() static uint32_t Popcount(uint32_t val);
8788

@@ -224,7 +225,8 @@ GPUdi() float GPUCommonMath::Floor(float x) { return CHOICE(floorf(x), floorf(x)
224225
#ifdef GPUCA_NO_FAST_MATH
225226
GPUdi() float GPUCommonMath::Round(float x) { return CHOICE(roundf(x), roundf(x), round(x)); }
226227
GPUdi() int32_t GPUCommonMath::Float2IntRn(float x) { return (int32_t)Round(x); }
227-
GPUdi() bool GPUCommonMath::Finite(float x) { return CHOICE(std::isfinite(x), isfinite(x), true); }
228+
GPUdi() bool GPUCommonMath::Finite(float x) { return CHOICE(std::isfinite(x), isfinite(x), true); } // Fixme: fix these 2 for OpenCL
229+
GPUdi() bool GPUCommonMath::IsNaN(float x) { return CHOICE(std::isnan(x), isnan(x), false); }
228230
GPUhdi() float GPUCommonMath::Sqrt(float x) { return CHOICE(sqrtf(x), (float)sqrt((double)x), sqrt(x)); }
229231
GPUdi() float GPUCommonMath::ATan(float x) { return CHOICE((float)atan((double)x), (float)atan((double)x), atan(x)); }
230232
GPUhdi() float GPUCommonMath::ATan2(float y, float x) { return CHOICE((float)atan2((double)y, (double)x), (float)atan2((double)y, (double)x), atan2(y, x)); }

0 commit comments

Comments
 (0)