TComplex operation accuracy

Hi there,

I’ve been digging around in the TComplex class recently and noticed that while calculations such as modulus are algebraically correct, it would be possible to increase numerical accuracy by using slightly different forms.

Currently a standard sqrt(a^2 + b^2) is used, but this can cause overflow problems which can be avoided. Similarly complex division and sqrt also have more accurate numerical forms.

The free online version of “Numerical Recipes in C” has a good discussion of ways to improve accuracy of complex arithmetic in section 5.4 (see the link below)

library.cornell.edu/nr/bookcpdf/c5-4.pdf

The ideas in this chapter can add significant accuracy to complex math. Perhaps this has already been taken care of in other ways, but if not, I hope this helps.

Josh de Bever
CSI Medical Physics Group
The University of Western Ontario
London, Ontario, Canada

System: Mac OSX 10.3.5, ROOT v4.01/04