Adding tests and vim support for double constant of the form .1d41

This commit is contained in:
Dmitry Babokin
2013-09-18 11:48:24 +04:00
parent f45f6cb32a
commit 1c527ae34c
2 changed files with 6 additions and 3 deletions

View File

@@ -21,6 +21,8 @@ syn keyword ispcType export uniform varying int8 int16 int32 int64
"double precision floating point number, with dot, optional exponent "double precision floating point number, with dot, optional exponent
syn match cFloat display contained "\d\+\.\d*d[-+]\=\d*\>" syn match cFloat display contained "\d\+\.\d*d[-+]\=\d*\>"
"double precision floating point number, starting with dot, optional exponent
syn match cFloat display contained ".\d*d[-+]\=\d*\>"
"double precision floating point number, without dot, with exponent "double precision floating point number, without dot, with exponent
syn match cFloat display contained "\d\+d[-+]\=\d\+\>" syn match cFloat display contained "\d\+d[-+]\=\d\+\>"

View File

@@ -7,12 +7,13 @@ export void f_f(uniform float RET[], uniform float aFOO[]) {
double d1 = 1.0d40; double d1 = 1.0d40;
double d2 = 1.d40; double d2 = 1.d40;
double d3 = 1d40; double d3 = 1d40;
double d4 = 10000000000000000000000000000000000000000.d; double d4 = .1d41;
double d5 = 10000000000000000000000000000000000000000.0d; double d5 = 10000000000000000000000000000000000000000.d;
double d6 = 10000000000000000000000000000000000000000.0d;
// All the constants should be equal and if it's evaluated as "float", // All the constants should be equal and if it's evaluated as "float",
// then sqrt will evaluate to +inf. // then sqrt will evaluate to +inf.
if (d1 == d2 && d1 == d3 && d1 == d4 && d1 == d5 && if (d1 == d2 && d1 == d3 && d1 == d4 && d1 == d5 && d1 == d6
((float)sqrt(d1)) < 2e20) { ((float)sqrt(d1)) < 2e20) {
RET[programIndex] = a; RET[programIndex] = a;
} }