problem with print_csrc_cl_N --> solved?

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Tue Aug 27 15:09:48 CEST 2002


Hi,

On Mon, 26 Aug 2002, Chris Dams wrote:
> Hello everybody,
> 
> Let's write something about GiNaC in order to improve the GiNaC/spam ratio
> in this mailing list a bit.

Oh, no need to apologize, you're welcome to send non-spam.   ;-)

The sad story is that SpamAssassin was installed at the University's email
front-door and immediately deinstalled again.  The reason was that it
interfered badly with some virus-scanner and people are currently
investigating how to solve the problems.  

Please don't start a thread now what is more important for grown-up users
-- filtering spam or filtering viruses.  I already did start such a thread
over here and found out that people who prefer to have spam filtered out
and don't care about MSVB scripts (i.e. "real men") seem to be a vanishing
minority.  :-(

> 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.

Thanks a lot for catching this.  I've applied it in CVS.

Cheers
    -richy.
-- 
Richard B. Kreckel
<Richard.Kreckel at GiNaC.DE>
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-devel mailing list