[GiNaC-devel] removing the evil

Richard B. Kreckel kreckel at ginac.de
Tue Jul 15 21:41:06 CEST 2008


Dear Alexei,

Alexei Sheplyakov wrote:
> 2. (a consequence of 1) No bugs like this:
> 
> ex e1, e2; 
> // do some calculation
> if (e1 == e2) { // gotcha: this is always true.
> 	// do something
> }

Well, over here I get:

$ cat relationaltest.cc
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main()
{
     symbol x("x");
     ex e1, e2;
     // do some calculation
     e1 = series(tgamma(x),x==0,3).op(3);
     e2 = series(log(x),x==1,6).op(4);
     cout << e1 << endl;
     cout << e2 << endl;
     if (e1 == e2) { // gotcha: what happens?
         cout << "e1 and e2 appear to be equal." << endl;
     } else {
         cout << "e1 and e2 appear to differ." << endl;
     }
}
$ g++ -O relationaltest.cc -lginac
$ ./a.out
-1/12*x^2*(2*Euler^3+Euler*Pi^2+4*zeta(3))
1/5*(-1+x)^5
e1 and e2 appear to differ.

What is your point?

Best wishes
    -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the GiNaC-devel mailing list