The code violates the Fortran standard. Two consecutive unary operators, - and / are not allowed. This is considered as extension, and the processor (compiler) can do whatever it wants. Possibly ifort decides to first execute the second fraction, giving -0.5, and then 1.0/(-0.5) gives -2.000. ifort -e08 rejects the code, nagfor rejects it always, and also gfortran with -std=f2008 rejects it. Without this, it accepts it as extension giving the desired result, but you should never count on that.
Threads/articles with similar topics: