tand function compatibility

Hello,

Sorry for asking again about the compatibility between ifort and pgf90, as I did in previous posts about the log function (log function compatibility) and the power operator (power operator compatibility), but I also found differences in the results returned by the tand function (tangent in degrees). For val1 results match, but for val2 don’t.

Please, refer to that posts where I explain why I need the same results even if the differences are so small in one particular calculation.

System: Intel Core i7 7820x, Linux CentOS 7.5.1804
Compilers: Intel Fortran 19.0.5.281 (ifort), PGI Fortran 19.10-0 (pgf90)
Compilation: Intel → ifort -o tand.ifort tand.f90; PGI → pgf90 -o tand.pgf90 tand.f90 -tp=px -Kieee

Results:
ifort
val1: -0.19099083542823791504
val2: -0.12464910000562667847
pgf90
val1: -0.19099083542823791504
val2: -0.12464910745620727539

program calctand

    real :: val1, val2

    val1 = -10.8127498626708984375
    val2 = -7.10521984100341796875

    write(*,'(A,F30.20)') 'val1: ', tand(val1)
    write(*,'(A,F30.20)') 'val2: ', tand(val2)

end program calctand

Is there another flag to make the results match? What is the reason for such discrepancies?

Thanks

Not in this case, but the results do match up to the 7th place which is the most that can be expected when using single precision even with strict IEEE 754 compliance enabled. When using double precision, the results match to the 17th place, so you may consider using double precision if you need more accuracy.

-Mat