However this causes a compilation error on the line calculating the exponent:
Semantic error: Line 102, Col 15: Semantic error: Line 102, Col 15: Types are not compatible
It seems that you cannot divide a double by another double and therefore only integer division is possible?
Thanks @dhj and @David-san, there were two problems - as you say one was that Exp is a function and the other was that I was trying to divide an integer by a double.
I was trying to divide timeX from the On TimePassing callback which is an integer by a double.
If I assign TimeX to a double first and use that in the expression it works fine.
So Integer divided by integer is OK and will return an integer and double divided by double is OK and will return a double but you can’t mix them.