You can try it out in Python directly which natively support complex numbers (just use j instead of i):
>>> import math
>>> z=1+2j
>>> z*complex.conjugate(z)
(5+0j)
>>> math.sqrt((z*complex.conjugate(z)).real)
2.23606797749979
>>> abs(z)
2.23606797749979
As we can see abs(z) does the right thing. Try it with a negative imaginary part too and "nicer" values: >> z = 3-4j
>>> math.sqrt((z*complex.conjugate(z)).real)
5.0
>>> abs(z)
5.0