atan2

Calculates the arc tangent of y / x, returning a value ranging from -π to π.

Special Values
yxatan(y, x)
NaNanythingNaN
anythingNaNNaN
±0.0>0.0±0.0
±0.0+0.0±0.0
±0.0<0.0±π
±0.0-0.0±π
>0.0±0.0π/2
<0.0±0.0-π/2
>0.0±0.0
±∞anything±π/2
>0.0-∞±π
±∞±π/4
±∞-∞±3π/4
  1. real atan2(real y, real x)
  2. double atan2(double y, double x)
    pragma(inline, true) @safe pure nothrow @nogc
    double
    atan2
    (
    double y
    ,
    double x
    )
  3. float atan2(float y, float x)

Examples

import std.math.operations : isClose;
import std.math.constants : PI;
import std.math.algebraic : sqrt;

assert(atan2(1.0, sqrt(3.0)).isClose(PI / 6));

Meta