Cannot evaluate numerically 2^Pi, for instance.

Pearu Peterson pearu at cens.ioc.ee
Sun Aug 19 09:45:25 CEST 2001


Hi,

I have found that when calling evalf() method for a power instance, its
exponent is not evaluated. Here follows an example that demonstrates this:
    
include <ginac/ginac.h>

using namespace GiNaC;
using namespace std;

int main(void)
{
  ex e = pow(2, Pi);
  cout << "e=";
  e.print(print_context(cout));
  cout << endl;
  cout << "e.evalf()=";
  e.evalf().print(print_context(cout));
  cout << endl;

  return 0;
}

The output is:
e=2^Pi
e.evalf()=(2.0)^Pi

And I don't see anything wrong in
	ex power::evalf(int level) const;
Do you?

Regards,
	Pearu




More information about the GiNaC-devel mailing list