The arc-tangent of two arguments atan2(y, x)
returns the angle
between the x-axis and the vector from the origin to \((x, y)\),
i.e., for positive arguments atan2(y, x) == atan(y/x)
.
Angles are in radians, not degrees, for the standard versions (i.e., a
right angle is \(\pi/2\)), and in ‘half-rotations’ for
cospi
etc.
cospi(x)
, sinpi(x)
, and tanpi(x)
are accurate
for x
values which are multiples of a half.
All except atan2
are internal generic primitive
functions: methods can be defined for them individually or via the
Math
group generic.
These are all wrappers to system calls of the same name (with prefix
c
for complex arguments) where available. (cospi
,
sinpi
, and tanpi
are part of a C11 extension
and provided by e.g.macOS and Solaris: where not yet
available call to cos
etc are used, with special cases
for multiples of a half.)