Function atan2 [src]

Alias for std.math.atan2.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

Prototype

pub fn atan2(y: anytype, x: anytype) @TypeOf(x, y)

Example

test atan2 { const y32: f32 = 0.2; const x32: f32 = 0.21; const y64: f64 = 0.2; const x64: f64 = 0.21; try expect(atan2(y32, x32) == atan2_32(0.2, 0.21)); try expect(atan2(y64, x64) == atan2_64(0.2, 0.21)); }

Source

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)), }; }