ANONYMOUS wrote:
> Hi,
>
> If an ml file has the expression; "3 / 2". or for example:
>
> function divide(a, b)
> x <- a/b
> return x
>
> and then this is called as divide(3, 2). This will obviously be a problem when translated to C, as 3 and 2 will be treated as integers not doubles.
>
> Simply adding (double)("Expression") is also not suitable as there may be many operations in an expression.
>
> Can we assume that this will not occur, as part of the No invalid expressions condition provided by Chris? Or do we need to find a way to manage this.
You can't pass "integers" to a function; the arguments are always doubles, so even if you pass 2, because the argument was defined to be a double, it will become 2.0. Every time you see a constant number, just put (double) in front of it or alternatively a decimal point and a zero, e.g. 2 becomes 2.0. I don't think you can ignore this issue as Chris explicitly uses constant integer values expecting the program to interpret them as doubles. However, Amitava said you can make assumptions and list them into a report, so maybe you don't anymore.