GNU Fortran supports an extended list of mathematical intrinsics with the compile flag -fdec-math for compatability with legacy code. These intrinsics are described fully in Intrinsic Procedures where it is noted that they are extensions and should be avoided whenever possible.
Specifically, -fdec-math enables the COTAN intrinsic, and trigonometric intrinsics which accept or produce values in degrees instead of radians. Here is a summary of the new intrinsics:
Radians | Degrees |
---|---|
ACOS |
ACOSD * |
ASIN |
ASIND * |
ATAN |
ATAND * |
ATAN2 |
ATAN2D * |
COS |
COSD * |
COTAN * |
COTAND * |
SIN |
SIND * |
TAN |
TAND * |
* Enabled with -fdec-math.
For advanced users, it may be important to know the implementation of these functions. They are simply wrappers around the standard radian functions, which have more accurate builtin versions. These functions convert their arguments (or results) to degrees (or radians) by taking the value modulus 360 (or 2*pi) and then multiplying it by a constant radian-to-degree (or degree-to-radian) factor, as appropriate. The factor is computed at compile-time as 180/pi (or pi/180).
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gfortran/Extended-math-intrinsics.html