"Bruno Luong" <firstname.lastname@example.org> wrote in message > > The documentation states that > > 1) an arithmetic expression is mixed with two numerical type, the result is cast in lower type, then the operation is carried out. > > 2) The expression is evaluated from left to right >
It seems that this rule does not applied for scalar expression affected with colon operator on the lhs. To avoid JIT, I put the argument as parameters of foo function.
function [a rd rs] = foo(b, c, d)
a = zeros(1,2,'double'); bar = b + c -d; a(1) = b + c -d; a(2) = bar;