Home

6.1.26 Extended math intrinsics

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:

RadiansDegrees
ACOSACOSD*
ASINASIND*
ATANATAND*
ATAN2ATAN2D*
COSCOSD*
COTAN*COTAND*
SINSIND*
TANTAND*

* 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).