Add a test file for ispc's isnan() function
This commit is contained in:
39
tests/isnan.ispc
Normal file
39
tests/isnan.ispc
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
export uniform int width() { return programCount; }
|
||||||
|
|
||||||
|
export void f_v(uniform float RET[]) {
|
||||||
|
int errors = 0;
|
||||||
|
for (uniform int i = -2; i <= 2; ++i) {
|
||||||
|
float f = log((float)i);
|
||||||
|
|
||||||
|
if ((i < 0) && (!isnan(f))) errors ++;
|
||||||
|
if ((i >= 0) && isnan(f)) errors ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uniform int i = -2; i <= 2; ++i) {
|
||||||
|
uniform float f = log((uniform float)i);
|
||||||
|
|
||||||
|
if ((i < 0) && (!isnan(f))) errors ++;
|
||||||
|
if ((i >= 0) && isnan(f)) errors ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uniform int i = -2; i <= 2; ++i) {
|
||||||
|
double f = log((double)i);
|
||||||
|
|
||||||
|
if ((i < 0) && (!isnan(f))) errors ++;
|
||||||
|
if ((i >= 0) && isnan(f)) errors ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uniform int i = -2; i <= 2; ++i) {
|
||||||
|
uniform double f = log((uniform double)i);
|
||||||
|
|
||||||
|
if ((i < 0) && (!isnan(f))) errors ++;
|
||||||
|
if ((i >= 0) && isnan(f)) errors ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
RET[programIndex] = errors;
|
||||||
|
}
|
||||||
|
|
||||||
|
export void result(uniform float RET[]) {
|
||||||
|
RET[programIndex] = 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user