Protoman said:
How do I calculate the log of a number?
Don't tell me to use log in cmath;
I'm trying to learn complex math in C++.
inline
double abs(const doubleComplex& c) {
return hypot(c.real(), c.imag()); }
inline
double arg(const doubleComplex& c) {
return atan2(c.imag(), c.real()); }
inline
doubleComplex log(const doubleComplex& c) {
return doubleComplex(log(abs(c)), arg(c)); }
The above definitions comes from
The C++ Scalar, Vector, Matrix and Tensor class Library
http://www.netwood.net/~edwin/svmtl/
in file svmtl/include/doubleComplex.h
Got any tips/ideas on how to do this?
Of course.
T. Lynch, A. Ahmed, M. Schulte, T. Callaway, R. Tisdale.
"The K5 transcendental functions,"
arith, vol. 00, no. , p. 163, 12th 1995.
Look for books on computer arithmetic
Search
http://www.amazon.com/ for
computer arithmetic
You will find lots of stuff including
Computer Arithmetic Algorithms by Israel Koren
Algorithms are off-topic in comp.lang.c++
Try comp.arch.arithmetic instead.