SimTk/openmm — pull request #589 by mgarraha (2014-08-18 19:01:41+00:00)
Title: avoid syntax error if tabulated function min is negative

My custom force uses a Continuous1DFunction with min=-0.5 and max=2.5. Without this change, the Reference platform gives the expected result, but the other platforms fail at Context creation time.

OpenCL:
> Exception: Error compiling kernel: :409:7: error: cannot decrement value of type 'real' (aka 'float')
> x = (x--5.00000000e-01f)*1.00000000e+01f;
> ~^
> :490:7: error: cannot decrement value of type 'real' (aka 'float')

CUDA:
> Exception: Error launching CUDA compiler: 512
> /tmp/openmmTempKernel0x288c1a0_22596.cu(1007): error: expected a ")"