# The SIND function in gnu fortran extension

**URL:** <https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148>\
**Category:** Uncategorized\
**Created:** [June 27, 2020, 1:52am UTC](https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148 "2020-06-27T01:52:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![han190](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/han190/32/7158_2.png) [@han190](https://fortran-lang.discourse.group/u/han190)\
**Post date:** [June 27, 2020, 1:52am UTC](https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148/1 "2020-06-27T01:52:06Z")

</div>

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

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

```

If you compile it with

```auto
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

```auto
gfortran mini.f90 -std=legacy

```

Based on [the page of SIND](https://gcc.gnu.org/onlinedocs/gfortran/SIND.html), one should be able to compile it with `-fdec-math`. However,

```auto
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?

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [June 27, 2020, 2:35am UTC](https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148/2 "2020-06-27T02:35:12Z")

</div>

Cannot you just use the function “sin”? That is what I recommend.

---

<div class="post-metadata">

**Author:** ![longb](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@longb](https://fortran-lang.discourse.group/u/longb)\
**Post date:** [June 27, 2020, 4:37am UTC](https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148/3 "2020-06-27T04:37:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [June 27, 2020, 10:35pm UTC](https://fortran-lang.discourse.group/t/the-sind-function-in-gnu-fortran-extension/148/6 "2020-06-27T22:35:31Z")

</div>

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.
