problem with print_csrc_cl_N --> solved?

Chris Dams chrisd at sci.kun.nl
Mon Aug 26 17:24:00 CEST 2002


Hello everybody,

Let's write something about GiNaC in order to improve the GiNaC/spam ratio
in this mailing list a bit.

I found that the following program

#include <ginac/ginac.h>
#include <iostream>
using namespace std;
using namespace GiNaC;

int main()
{       symbol a("a"),b("b");
        (-2*a-2*b).print(print_csrc_cl_N(cout));
        cout << endl;
        return 0;
}

gives as output:

cln::cl_F("-2.0")*bcln::cl_F("-2.0")*a

This does not compile since there should be a + between the b and the
cln::cl_F. The problem disappears if I change the line

if (it != itend && !(it->coeff.info(info_flags::negative) ||
(it->coeff.is_equal(_num1) && is_exactly_a<numeric>(it->rest) &&
it->rest.info(info_flags::negative))))

which occurs in the file add.cpp to

if (it != itend && (is_a<print_csrc_cl_N>(c) ||
!(it->coeff.info(info_flags::negative) || (it->coeff.is_equal(_num1) &&
is_exactly_a<numeric>(it->rest) && it->rest.info(info_flags::negative)))))

Now the output of the test program is

cln::cl_F("-2.0")*b+cln::cl_F("-2.0")*a

which compiles correctly.

Greetings,
Chris Dams





More information about the GiNaC-devel mailing list