Вопрос

Here a small snippet of code that returns epsilon() for a real value:

program epstest
real :: eps=1.0, d
do
  d=1.0+eps  
  if (d==1.0) then
    eps=eps*2
    exit
  else
    eps=eps/2
  end if
end do
write(*,*) eps, epsilon(d)
pause
end program

Now, when I replace the if condition by

   if (1.0+eps==1.0) then

the program should have the same in return but it unfortunately does not! I tested it with the latest (snapshot) release of g95 on Linux and Windows.

Can someone explain that issue to me?

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top