The following program print 1 for 100E-2 and gives 0 for 100*10**(-2), that means that
the operator exponent doesnot work for negative **, is that correct.
Thanks in advance
program testme
implicit none
print*,100E-2
print*,100*10**(-2)
end program
You’ll notice that the second print statement prints
0— no decimal pt, etc. Eg, integer zero. That’s because10by itself is an integer literal, and raising that to the negative 2 power correctly gives zero; multiplying it by integer 100 still gives integer zero.If you instead use
you’ll get the answer you expect.
The issue doesn’t arise with
100e-2because any number expressed with scientific notation is a floating point (real) literal.