Boost logo

Boost Users :

From: Chris Weed (chrisweed_at_[hidden])
Date: 2007-02-20 20:56:00


Hi,
I am getting the wrong result for the exponential of complex numbers
such as the following:

#include <boost/mpl/math/double.hpp>
#include <boost/mpl/math/complex_number.hpp>
#include <iostream>

int main()
{
  typedef boost::mpl::math::string_c_to_double<'-',2,'.',0>::type minus_two;
  typedef boost::mpl::times<minus_two,boost::mpl::math::pi<boost::mpl::math::double_tag>
>::type minus_two_pi;
  typedef boost::mpl::math::complex_number<double_zero,minus_two_pi>
imag_minus_two_pi;
  std::cout << imag_minus_two_pi() << std::endl;

  std::cout << boost::mpl::math::exponential<imag_minus_two_pi>::type()
<< std::endl;
  return 0;
}

This prints:
0-6.28319i
1.0329-0.0109834i

which should be
0-6.28319i
1.0000-0.00000i

Chris


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net