Wrong (strange outputs) of real numbers

Your compiler uses 32 bits real by default.

Try z1=0.7d0 to use double precision (64 bits). The last digit may still be false, but it is normal, real numbers are stored with a limited number of bits in your CPU and in binary. And for example 0.7 has an infinite number of digits in base 2:

0.7 = 0b0.10110011001100110011001100110011001100110011001101...

Note also there are better ways to declare real numbers in modern Fortran. See that discussion:

And see also that tool:

2 Likes