DoxigAlpha

atan2

Returns the arc-tangent of y/x.

Special Cases:

y x radians
fin nan nan
nan fin nan
+0 >=+0 +0
-0 >=+0 -0
+0 <=-0 pi
-0 <=-0 -pi
pos 0 +pi/2
neg 0 -pi/2
+inf +inf +pi/4
-inf +inf -pi/4
+inf -inf 3pi/4
-inf -inf -3pi/4
fin +inf 0
pos -inf +pi
neg -inf -pi
+inf fin +pi/2
-inf fin -pi/2

Function parameters

Parameters

#
y:anytype
x:anytype

Returns the arc-tangent of y/x.

Functions

#
atan2
Returns the arc-tangent of y/x.

Source

Implementation

#
pub fn atan2(y: anytype, x: anytype) @TypeOf(x, y) {
    const T = @TypeOf(x, y);
    return switch (T) {
        f32 => atan2_32(y, x),
        f64 => atan2_64(y, x),
        else => @compileError("atan2 not implemented for " ++ @typeName(T)),
    };
}