summarylogtreecommitdiffstats
path: root/isnan.patch
blob: f085755a01f076f03fc6676fa437bc25b8c3976e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
diff --git a/utests/builtin_acos_asin.cpp b/utests/builtin_acos_asin.cpp
index 0187226..395460b 100644
--- a/utests/builtin_acos_asin.cpp
+++ b/utests/builtin_acos_asin.cpp
@@ -59,10 +59,10 @@ static void builtin_acos_asin(void)
     {
       index_cur = k * max_function + i;
 #if udebug
-      if (isinf(cpu_data[index_cur]) && !isinf(gpu_data[index_cur])){
+      if (std::isinf(cpu_data[index_cur]) && !std::isinf(gpu_data[index_cur])){
         printf_c("%d/%d: %f -> gpu:%f  cpu:%f\n", k, i, input_data[k], gpu_data[index_cur], cpu_data[index_cur]);
       }
-      else if (isnan(cpu_data[index_cur]) && !isnan(gpu_data[index_cur])){
+      else if (std::isnan(cpu_data[index_cur]) && !std::isnan(gpu_data[index_cur])){
         printf_c("%d/%d: %f -> gpu:%f  cpu:%f\n", k, i, input_data[k], gpu_data[index_cur], cpu_data[index_cur]);
       }
       else if(fabs(gpu_data[index_cur] - cpu_data[index_cur]) > 1e-3f){
@@ -71,10 +71,10 @@ static void builtin_acos_asin(void)
       else
         printf("%d/%d: %f -> gpu:%f  cpu:%f\n", k, i, input_data[k], gpu_data[index_cur], cpu_data[index_cur]);
 #else
-     if (isinf(cpu_data[index_cur]))
-       OCL_ASSERT(isinf(gpu_data[index_cur]));
-     else if (isnan(cpu_data[index_cur]))
-       OCL_ASSERT(isnan(gpu_data[index_cur]));
+     if (std::isinf(cpu_data[index_cur]))
+       OCL_ASSERT(std::isinf(gpu_data[index_cur]));
+     else if (std::isnan(cpu_data[index_cur]))
+       OCL_ASSERT(std::isnan(gpu_data[index_cur]));
      else
      {
        OCL_ASSERT(fabs(gpu_data[index_cur] - cpu_data[index_cur]) < 1e-3f);
diff --git a/utests/builtin_exp.cpp b/utests/builtin_exp.cpp
index d5288c8..406d223 100644
--- a/utests/builtin_exp.cpp
+++ b/utests/builtin_exp.cpp
@@ -71,10 +71,10 @@ static void builtin_exp(void)
          diff/gpu_data[index_cur], 3 * FLT_ULP);
 
 #if udebug
-      if (isinf(cpu_data[index_cur]) && isinf(gpu_data[index_cur])){
+      if (std::isinf(cpu_data[index_cur]) && std::isinf(gpu_data[index_cur])){
         printf(log);
       }
-      else if (isnan(cpu_data[index_cur]) && isnan(gpu_data[index_cur])){
+      else if (std::isnan(cpu_data[index_cur]) && std::isnan(gpu_data[index_cur])){
         printf(log);
       }
       else if( diff / cpu_data[index_cur] < 3 * FLT_ULP \
@@ -86,10 +86,10 @@ static void builtin_exp(void)
       else
         printf_c(log);
 #else
-      if (isinf(cpu_data[index_cur]))
-        OCL_ASSERTM(isinf(gpu_data[index_cur]), log);
-      else if (isnan(cpu_data[index_cur]))
-        OCL_ASSERTM(isnan(gpu_data[index_cur]), log);
+      if (std::isinf(cpu_data[index_cur]))
+        OCL_ASSERTM(std::isinf(gpu_data[index_cur]), log);
+      else if (std::isnan(cpu_data[index_cur]))
+        OCL_ASSERTM(std::isnan(gpu_data[index_cur]), log);
       else if ( gpu_data[index_cur] > FLT_ULP || cpu_data[index_cur] > FLT_ULP)
         OCL_ASSERTM(fabs( diff / cpu_data[index_cur]) < 3 * FLT_ULP, log);
       else
diff --git a/utests/builtin_pow.cpp b/utests/builtin_pow.cpp
index f586448..21fa895 100644
--- a/utests/builtin_pow.cpp
+++ b/utests/builtin_pow.cpp
@@ -74,8 +74,8 @@ static void builtin_pow(void)
     {
       index_cur = k * max_function + i;
 #if udebug
-      if ( (isinf(cpu_data[index_cur]) && !isinf(gpu_data[index_cur])) ||
-           (isnan(cpu_data[index_cur]) && !isnan(gpu_data[index_cur])) ||
+      if ( (std::isinf(cpu_data[index_cur]) && !std::isinf(gpu_data[index_cur])) ||
+           (std::isnan(cpu_data[index_cur]) && !std::isnan(gpu_data[index_cur])) ||
            (fabs(gpu_data[index_cur] - cpu_data[index_cur]) > cl_FLT_ULP(cpu_data[index_cur]) * ULPSIZE_FACTOR
            && (denormals_supported || gpu_data[index_cur]!=0 || std::fpclassify(cpu_data[index_cur])!=FP_SUBNORMAL) ) )
 
@@ -85,10 +85,10 @@ static void builtin_pow(void)
       else
         printf("%d/%d: x:%f, y:%f -> gpu:%f  cpu:%f\n", k, i, input_data1[k], input_data2[k], gpu_data[index_cur], cpu_data[index_cur]);
 #else
-     if (isinf(cpu_data[index_cur]))
-       OCL_ASSERT(isinf(gpu_data[index_cur]));
-     else if (isnan(cpu_data[index_cur]))
-       OCL_ASSERT(isnan(gpu_data[index_cur]));
+     if (std::isinf(cpu_data[index_cur]))
+       OCL_ASSERT(std::isinf(gpu_data[index_cur]));
+     else if (std::isnan(cpu_data[index_cur]))
+       OCL_ASSERT(std::isnan(gpu_data[index_cur]));
      else
      {
        OCL_ASSERT((fabs(gpu_data[index_cur] - cpu_data[index_cur]) < cl_FLT_ULP(cpu_data[index_cur]) * ULPSIZE_FACTOR) ||
diff --git a/utests/builtin_tgamma.cpp b/utests/builtin_tgamma.cpp
index db9ab3c..204f49e 100644
--- a/utests/builtin_tgamma.cpp
+++ b/utests/builtin_tgamma.cpp
@@ -43,8 +43,8 @@ void builtin_tgamma(void)
         max_ulp = fabsf(cpu - dst[i]) / cl_FLT_ULP(cpu);
         max_ulp_at = src[i];
       }
-      if (isinf(cpu)) {
-        OCL_ASSERT(isinf(dst[i]));
+      if (std::isinf(cpu)) {
+        OCL_ASSERT(std::isinf(dst[i]));
       } else if (fabsf(cpu - dst[i]) >= cl_FLT_ULP(cpu) * ULPSIZE_FACTOR) {
         printf("%f %f %f\n", src[i], cpu, dst[i]);
         OCL_ASSERT(0);
diff --git a/utests/compiler_half.cpp b/utests/compiler_half.cpp
index d486193..194c308 100644
--- a/utests/compiler_half.cpp
+++ b/utests/compiler_half.cpp
@@ -236,7 +236,7 @@ static float half_test_src[half_n] = {
       OCL_ASSERT(((fabs(fdst[i]) < 6e-8f) && (fabs(f) < 6e-8f)) ||      \
                  (fabs(f - fdst[i]) <= 0.03 * fabs(fdst[i])) ||         \
                  (isInf && ((infSign && fdst[i] > 65504.0f) || (!infSign && fdst[i] < -65504.0f))) || \
-                 (isnan(f) && isnan(fdst[i])));                         \
+                 (std::isnan(f) && std::isnan(fdst[i])));                         \
     }                                                                   \
     OCL_UNMAP_BUFFER(1);                                                \
   }                                                                     \
@@ -310,7 +310,7 @@ HALF_MATH_TEST_1ARG(ceil, ceilf);
     OCL_ASSERT(((fabs(fdst[i]) < 6e-8f) && (fabs(f) < 6e-8f)) ||        \
                (fabs(f - fdst[i]) <= 0.03 * fabs(fdst[i])) ||           \
                (isInf && ((infSign && fdst[i] > 65504.0f) || (!infSign && fdst[i] < -65504.0f))) || \
-               (isnan(f) && isnan(fdst[i])));                           \
+               (std::isnan(f) && std::isnan(fdst[i])));                           \
     }                                                                   \
     OCL_UNMAP_BUFFER(2);                                                \
   }                                                                     \
diff --git a/utests/compiler_math.cpp b/utests/compiler_math.cpp
index e0c4487..0c238c9 100644
--- a/utests/compiler_math.cpp
+++ b/utests/compiler_math.cpp
@@ -72,10 +72,10 @@ static void compiler_math(void)
     for (int i = 0; i < 16; ++i) {
       const float cpu = cpu_dst[i];
       const float gpu = ((float*)buf_data[0])[i];
-      if (isinf(cpu))
-        OCL_ASSERT(isinf(gpu));
-      else if (isnan(cpu))
-        OCL_ASSERT(isnan(gpu));
+      if (std::isinf(cpu))
+        OCL_ASSERT(std::isinf(gpu));
+      else if (std::isnan(cpu))
+        OCL_ASSERT(std::isnan(gpu));
       else
         OCL_ASSERT(fabs(gpu-cpu) < 1e-3f);
     }
diff --git a/utests/compiler_math_2op.cpp b/utests/compiler_math_2op.cpp
index 454967d..d771dba 100644
--- a/utests/compiler_math_2op.cpp
+++ b/utests/compiler_math_2op.cpp
@@ -65,10 +65,10 @@ static void compiler_math_2op(void)
     for (int i = 0; i < 16; ++i) {
       const float cpu = cpu_dst[i];
       const float gpu = ((float*)buf_data[0])[i];
-      if (isinf(cpu))
-        OCL_ASSERT(isinf(gpu));
-      else if (isnan(cpu))
-        OCL_ASSERT(isnan(gpu));
+      if (std::isinf(cpu))
+        OCL_ASSERT(std::isinf(gpu));
+      else if (std::isnan(cpu))
+        OCL_ASSERT(std::isnan(gpu));
       else {
         OCL_ASSERT(fabs(gpu-cpu) < 1e-3f);
       }
diff --git a/utests/compiler_math_3op.cpp b/utests/compiler_math_3op.cpp
index a382b0a..f90f9d6 100644
--- a/utests/compiler_math_3op.cpp
+++ b/utests/compiler_math_3op.cpp
@@ -50,10 +50,10 @@ static void compiler_math_3op(void)
     for (int i = 0; i < 16; ++i) {
       const float cpu = cpu_dst[i];
       const float gpu = ((float*)buf_data[0])[i];
-      if (isinf(cpu))
-        OCL_ASSERT(isinf(gpu));
-      else if (isnan(cpu))
-        OCL_ASSERT(isnan(gpu));
+      if (std::isinf(cpu))
+        OCL_ASSERT(std::isinf(gpu));
+      else if (std::isnan(cpu))
+        OCL_ASSERT(std::isnan(gpu));
       else
         OCL_ASSERT(fabs(gpu-cpu) < 1e-3f);
     }
diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index 91cc938..2ab908e 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -112,10 +112,10 @@ def udebug(ulpSize,returnType,function):
     ULPSIZE_FACTOR = select_ulpsize(ULPSIZE_FAST_MATH,ULPSIZE_NO_FAST_MATH);
     bool fast_math = ULPSIZE_FACTOR == ULPSIZE_FAST_MATH;
 
-    if (isinf(cpu_data[index])){
+    if (std::isinf(cpu_data[index])){
       INFORNAN="INF";
     }
-    else if (isnan(cpu_data[index])){
+    else if (std::isnan(cpu_data[index])){
       INFORNAN="NAN";
     }
     else{
@@ -124,14 +124,14 @@ def udebug(ulpSize,returnType,function):
     }
 
 #if udebug 
-    if (isinf(cpu_data[index])){ 
-      if (isinf(gpu_data[index]))
+    if (std::isinf(cpu_data[index])){ 
+      if (std::isinf(gpu_data[index]))
         printf("%s expect:%s\\n", log, INFORNAN);
       else
         printf_c("%s expect:%s\\n", log, INFORNAN);
       }
-    else if (isnan(cpu_data[index])){
-      if (isnan(gpu_data[index]))
+    else if (std::isnan(cpu_data[index])){
+      if (std::isnan(gpu_data[index]))
         printf("%s expect:%s\\n", log, INFORNAN);
       else
         printf_c("%s expect:%s\\n", log, INFORNAN);
@@ -142,13 +142,13 @@ def udebug(ulpSize,returnType,function):
     else
       printf_c("%s expect:%s\\n", log, ULPSIZE);
 #else
-    if (isinf(cpu_data[index])){
+    if (std::isinf(cpu_data[index])){
       sprintf(log, "%s expect:%s\\n", log, INFORNAN);
-      OCL_ASSERTM(isinf(gpu_data[index]) || fast_math,log);
+      OCL_ASSERTM(std::isinf(gpu_data[index]) || fast_math,log);
     }
-    else if (isnan(cpu_data[index])){
+    else if (std::isnan(cpu_data[index])){
       sprintf(log, "%s expect:%s\\n", log, INFORNAN);
-      OCL_ASSERTM(isnan(gpu_data[index]) || fast_math,log);
+      OCL_ASSERTM(std::isnan(gpu_data[index]) || fast_math,log);
     }
     else{
       sprintf(log, "%s expect:%s\\n", log, ULPSIZE);
diff --git a/utests/utest_math_gen.py b/utests/utest_math_gen.py
index eca6c87..ac70979 100755
--- a/utests/utest_math_gen.py
+++ b/utests/utest_math_gen.py
@@ -490,9 +490,9 @@ static float powr(float x, float y){
         return 1;
     else if ((x == +INFINITY) && (y == 0.0f))
         return NAN;
-    else if (isnan(x) || (x < 0))
+    else if (std::isnan(x) || (x < 0))
         return NAN;
-    else if ((x >=  0) && (isnan(y)))
+    else if ((x >=  0) && (std::isnan(y)))
         return NAN;
     else
         return powf(x,y);