There are now native complex funcs (e.g ctan) in C++ that could be used (and which have better overflow handling).