5.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 — Cotangent function intrinsic, and trigonometric intrinsics which accept or produce values in degrees instead of radians. Here is a summary of the new intrinsics:

RadiansDegrees
ACOS — Arccosine functionACOSD — Arccosine function, degrees*
ASIN — Arcsine functionASIND — Arcsine function, degrees*
ATAN — Arctangent functionATAND — Arctangent function, degrees*
ATAN2 — Arctangent functionATAN2D — Arctangent function, degrees*
COS — Cosine functionCOSD — Cosine function, degrees*
COTAN — Cotangent function*COTAND — Cotangent function, degrees*
SIN — Sine functionSIND — Sine function, degrees*
TAN — Tangent functionTAND — Tangent function, degrees*

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