DoxigAlpha

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.

Function parameters

Parameters

#
z:anytype

Returns the square root of z.

Functions

#
sqrt
Returns the square root of z.

Source

Implementation

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