When an (sub)expression is evaluated, the actual calculation in the CPU must be between operands of the same type, this means if the expression is of mixed type, the compiler must automatically convert (promote or coerce) one type to another. Default types have an implied ordering
thus if an INTEGER is mixed with a REAL the INTEGER is promoted to a REAL and then the calculation performed; the resultant expression is of type REAL.
For example,
Consider the expression,
int*real*dp*c
the types are coerced as follows:
The above expression is therefore COMPLEX valued.
Note that numeric and non-numeric types cannot be mixed using intrinsic operators, nor can LOGICAL and CHARACTER.
In general one must think hard and long about mixed mode arithmetic!
Return to corresponding overview page