Date: Feb 7, 2013 9:39 AM
Author: Bruno Luong
Subject: Re: Computation precision on command line and in scripts
"Pierre" wrote in message <email@example.com>...
> The underlying question was: Are computations with singles performed in double or in single precision??
This question is interesting but actually is not a right question to ask.
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
That explains the result like:
IMO the observation in your example is not due to casting, but due to JIT accelerator might detect (single(1) - 1) is 0. The JIT is activated or not in different mode (command line, function, or debug mode). It also depends on which MATLAB version you are running.