Pre-processing large mathematical expressions for gmp?

Torbjorn Granlund tg at
Tue Jun 15 10:40:36 CEST 2010

Jim Skea <jimskea at> writes:

  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);
If you don't mind writing in C++, the GMP C++ wrapper (which is
distributed with GMP) will do this for you.


More information about the gmp-discuss mailing list