Test, documentation and vim support for double precision constants
This commit is contained in:
23
tests/double-consts.ispc
Normal file
23
tests/double-consts.ispc
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
double a = aFOO[programIndex];
|
||||
// Test parsing of double constants.
|
||||
double d1 = 1.0d40;
|
||||
double d2 = 1.d40;
|
||||
double d3 = 1d40;
|
||||
double d4 = 10000000000000000000000000000000000000000.d;
|
||||
double d5 = 10000000000000000000000000000000000000000.0d;
|
||||
|
||||
// All the constants should be equal and if it's evaluated as "float",
|
||||
// then sqrt will evaluate to +inf.
|
||||
if (d1 == d2 && d1 == d3 && d1 == d4 && d1 == d5 &&
|
||||
((float)sqrt(d1)) < 2e20) {
|
||||
RET[programIndex] = a;
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 1 + programIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user