Function sqrt [src]
Alias for std.math.complex.sqrt.sqrt
Returns the square root of z. The real and imaginary parts of the result have the same sign
as the imaginary part of z.
Prototype
pub fn sqrt(z: anytype) Complex(@TypeOf(z.re, z.im))
Source
pub fn sqrt(z: anytype) Complex(@TypeOf(z.re, z.im)) {
const T = @TypeOf(z.re, z.im);
return switch (T) {
f32 => sqrt32(z),
f64 => sqrt64(z),
else => @compileError("sqrt not implemented for " ++ @typeName(T)),
};
}