The XBCD_Math package has been extended to include complex versions of all supported functions. These complex functions are easily accessed through the complex class available here. The files available include example applications for extended precision complex numeric date types. Note that this package contains a static library which is currently only available for Borland compilers.
Here is a brief example of a simple C++ file using the package.
static xcomplex I(0,1);
cout << "I^I = " << pow(I,I) << endl;
x = xcomplex(2,1);
cout << "sin(2+I) = " << sin(x) << endl;
x = (xfloat)1;
cout << "Pi = " << 4*atan(x) << endl;
The output from this file is:
Pi = (3.141592653589793238462643383279502884197169399375105820975E+0000,
Using xcomplex introduces additional real and complex numeric types into the programming environment and imposes additional burdens on the programmer. One of these burdens involves proper management of the various numeric types.
Promotion of C/C++ primitive types (int, float, etc) to xcomplex is not fully implemented, but casting is supported to simplify interfacing with typical numeric software. The preferred way to manage low precision numbers and constants is to cast them to xfloat type, which will be automatically promoted to xcomplex as needed. (Part of the fun of converting real types to complex types is that complex numbers require more information, not just more precision, than real numbers.)
The constructors for xcomplex do support promotions of low precision data types, so it is possible to bypass casting when variables are created. Just keep in mind that an expression such as:
z = 4*atan(1)
will evaluate to an ordinary float at low precision. If you want to establish and maintain extended precision, use:
z = 4*atan((xfloat)1)
This, by the way, is the same type of problem that is found in mixing integer types with floats in standard C and C++. It is no more burdensome, but does demand undivided attention from the programmer.
The current version of the downloadable software includes static libraries for the math package and classes which were created under Borland C++. Hence, they are not usable with other platforms. As the software moves toward a releasable form, it will be compiled under other platforms, probably Microsoft VC++ and Linux. You can try things out with this zip archive.