Problems exp'ing complex numbers

Wolfgang Mauerer wolfgang@mynetix.de
Sat Dec 30 10:41:00 GMT 2000


Hello,

I experienced a problem related to the libstdc++ complex<>-Class and
don't know wether it's my false understanding of the problem, a bug
in libstdc++ or a feature that's intentionaly missing from the
library. When I use the program code

<snap>
long_double_complex test (some, value)
cout << exp(test) << endl;
</snap>

I get (inf, nan) as result when huge numbers are used.

The error doesn't appear any more if the following template
specialisation is used:

complex<long double> exp(const complex<long double> x) {
  return polar(expl(real(x)), imag(x));
}

I would appreciate if someone of you could give me a hint
wether my code is erroneous or this is a feature that's missing
from libstdc++ and shouldn't do so.

Thanks,

Wolfgang

P.S.: Please CC to my eMail address since I'm not on that list.


More information about the Libstdc++ mailing list