Function abs [src]
Alias for std.math.complex.abs.abs
Returns the absolute value (modulus) of z.
Prototype
pub fn abs(z: anytype) @TypeOf(z.re, z.im)
Example
test abs {
const epsilon = math.floatEps(f32);
const a = Complex(f32).init(5, 3);
const c = abs(a);
try testing.expectApproxEqAbs(5.8309517, c, epsilon);
}
Source
pub fn abs(z: anytype) @TypeOf(z.re, z.im) {
return math.hypot(z.re, z.im);
}