Test, documentation and vim support for double precision constants

This commit is contained in:
Dmitry Babokin
2013-09-17 23:36:16 +04:00
parent ff547fc6cb
commit f45f6cb32a
3 changed files with 38 additions and 1 deletions

23
tests/double-consts.ispc Normal file
View 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;
}