The SIND function in gnu fortran extension

Hi, all
Here is the minimal code to reproduce the problem:

program main
    print *, sind(45.)
end program main

If you compile it with

gfortran mini.f90

the compiler will compile it with no problem, but if you use the -std flag, the compiler will only compile it if you use

gfortran mini.f90 -std=legacy

Based on the page of SIND, one should be able to compile it with -fdec-math. However,

gfortran mini.f90 -fdec-math -std=f2018

will not work.

I know for the purpose of portability I probably should not use the function SIND, but all major Fortran compilers like gfortran or ifort have this function built in. Are there any work-arounds?

Cannot you just use the function β€œsin”? That is what I recommend.

I would note that SIND and the related degree trig functions are on the work list for inclusion in the next Fortran Standard (known as 202X), partly, as you note, because a lot of compilers already support it anyway. In the long run SIND should be portable.


You are right. I initially thought the question was about dsin (double precision sin). But sind is the sin function in degrees, so the suggested solutions are the way to go.