Abs of complex number

Is there a nicer way to get the absolute value of a complex number?

I currently have ((z.re * z.re) + (z.im * z.im)).sqrt() where z: num::Complex<f64>. In python, I can write this as abs(z).

the num crate doesn't seem to have abs() for complex numbers. Just wondering if I'm missing something? If not, may be my first contribution for a rust project...

Looks like the method is called norm.

1 Like

Thanks, I just stumbled on that too. :+1: