There are 3 different ways that the multiplication can be ordered. Gfortran and ifort happen to choose different orders. Using brackets you can see what is going on:
ian@eris:~/work/stack$ cat mult.f90
implicit none
double precision:: a,b,c,d
200 format(F35.20)
b=20.17865682672815452747d0
c=3.75000000000000000000d0
d=32.17399999999999948841d0
a=(b*c)*d
write(*,200)a
b=20.17865682672815452747d0
c=3.75000000000000000000d0
d=32.17399999999999948841d0
a=b*(c*d)
write(*,200)a
b=20.17865682672815452747d0
c=3.75000000000000000000d0
d=32.17399999999999948841d0
a=c*(b*d)
write(*,200)a
end program
ian@eris:~/work/stack$ gfortran --version
GNU Fortran (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ian@eris:~/work/stack$ gfortran -O2 mult.f90
ian@eris:~/work/stack$ ./a.out
2434.60539278681835639873
2434.60539278681881114608
2434.60539278681881114608
Both answers are perfectly correct - you are just seeing one of the effects of floating point maths.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…