From 1c527ae34cf7c257f8deaf0261af447b238cab56 Mon Sep 17 00:00:00 2001 From: Dmitry Babokin Date: Wed, 18 Sep 2013 11:48:24 +0400 Subject: [PATCH] Adding tests and vim support for double constant of the form .1d41 --- contrib/ispc.vim | 2 ++ tests/double-consts.ispc | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/ispc.vim b/contrib/ispc.vim index 4d870dcd..f3cb413b 100644 --- a/contrib/ispc.vim +++ b/contrib/ispc.vim @@ -21,6 +21,8 @@ syn keyword ispcType export uniform varying int8 int16 int32 int64 "double precision floating point number, with dot, optional exponent 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 syn match cFloat display contained "\d\+d[-+]\=\d\+\>" diff --git a/tests/double-consts.ispc b/tests/double-consts.ispc index 3259156a..4096aa1c 100644 --- a/tests/double-consts.ispc +++ b/tests/double-consts.ispc @@ -7,12 +7,13 @@ export void f_f(uniform float RET[], uniform float aFOO[]) { double d1 = 1.0d40; double d2 = 1.d40; double d3 = 1d40; - double d4 = 10000000000000000000000000000000000000000.d; - double d5 = 10000000000000000000000000000000000000000.0d; + double d4 = .1d41; + double d5 = 10000000000000000000000000000000000000000.d; + double d6 = 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 && + if (d1 == d2 && d1 == d3 && d1 == d4 && d1 == d5 && d1 == d6 ((float)sqrt(d1)) < 2e20) { RET[programIndex] = a; }