Pre-processing large mathematical expressions for gmp?

Jim Skea jimskea at
Tue Jun 15 02:32:02 CEST 2010

Does anyone know of a pre-processor that would take a long mathematical
expression and convert it into the equivalent set of gmp function calls,
creating any temporary variables as necessary?

Something that would take, as a small example
y = y + h6*(k1+2*k2+2*k3+k4)

 and produce

 mpf_mul_ui(t0, k3, 2);
 mpf_mul_ui(t1, k2, 2);
 mpf_add(y, y, t5);

 Failing that, any idea about how to do this (using yacc? bison?) other than
writing a dedicated program?

Thanks in advance.


More information about the gmp-discuss mailing list