problem with print_csrc and mul

Hugo LECLERC hugo_lec at club-internet.fr
Wed May 23 15:32:56 CEST 2001


  Dear GiNaC developpers,


  with GiNaC V0.8.2 and V0.8.3, there is a problem when one wants to print a 
formula with print_csrc_context and a mul into:

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

int main(int argc, char *argv[])
{
	symbol x("x"),y("y");
	ex expr=x*y;
	expr.print(print_csrc_double(cout));
	
	return EXIT_SUCCESS;
}

gives :

(y*x

( and not y*x )

It becomes better when in mul.cpp, line 139, we had
		if (precedence <= level)
before
			c.s << "(";


That's all.

Best regards and many thanks for your work!

PS: I'm actually looking for how to convert GiNaC list of expressions in 
optimized C code (like "convert to C" in mathlab). I've already begun and my 
question is : is there anything done in this domain?

-
Hugo LECLERC
L.M.A.R.C.
Laboratory of Applied Mechanics R. Chaléat
UMR CNRS 6604, UFR Sciences et Techniques
24, chemin de l'Epitaphe
25000 BESANCON - FRANCE

Tel : +33 (0)3 81 66 60 11 ou +33 (0)3 81 66 67 21
Fax : +33 (0)3 81 66 67 00



More information about the GiNaC-devel mailing list