Problems often occur with mixed-type arithmetic; the rules for type conversion are given below.
The RHS is evaluated, truncated (all the decimal places lopped off) then assigned to the LHS.
The RHS is promoted to be REAL and stored (approximately) in the LHS.
REAL :: a = 1.1, b = 0.1 INTEGER :: i, j, k i = 3.9 ! i will be 3 j = -0.9 ! j will be 0 k = a - b ! k will be 1 or 0 a = j ! a will be about 1.0 or 0.0
Note: as a and b stored approximately, the value of k is uncertain.
For more information, click here