Files
ispc/tests/transcendentals-1-3.ispc
2012-05-30 13:06:07 -07:00

30 lines
980 B
Plaintext

static float float4(uniform float a, uniform float b, uniform float c,
uniform float d) {
float ret = 0;
for (uniform int i = 0; i < programCount; i += 4) {
ret = insert(ret, i + 0, a);
ret = insert(ret, i + 1, b);
ret = insert(ret, i + 2, c);
ret = insert(ret, i + 3, d);
}
return ret;
}
export uniform int width() { return programCount; }
bool ok(float x, float ref) {
bool r = (abs(x - ref) < 1e-5) || abs((x-ref)/ref) < 1e-5;
if (any(r == false))
print("mismatch got %, expected %\n", x, ref);
return r;
}
export void f_v(uniform float RET[]) {
float v = float4((14.300000190734863),(-6.699999809265137),(-21.200000762939453),(9.000000000000000));
float ref = float4((-0.162114620208740),(0.914383232593536),(-0.703029513359070),(-0.911130249500275));
RET[programIndex] = ok(cos(v), ref) ? 1. : 0.;
}
export void result(uniform float RET[]) { RET[programIndex] = 1.; }