Pre-processing large mathematical expressions for gmp?
James Cloos
cloos at jhcloos.com
Tue Jun 15 18:33:00 CEST 2010
>>>>> "JS" == Jim Skea <jimskea at gmail.com> writes:
JS> Does anyone know of a pre-processor that would take a long mathematical
JS> expression and convert it into the equivalent set of gmp function calls,
JS> creating any temporary variables as necessary?
Google for 'infix to rpn'. Some of the hits are:
http://montcs.bloomu.edu/Information/RPN/infix2rpn.shtml
http://en.wikipedia.org/wiki/Shunting-yard_algorithm
http://web.bvu.edu/faculty/traylor/CS_Help_Stuff/infix_to_rpn.htm
http://perlgolf.sourceforge.net/TPR/0/5a/
http://perlgolf.sourceforge.net/cgi-bin/PGAS/post_mortem.cgi?id=9
http://www.seas.gwu.edu/~csci133/fall04/133f04toRPN.html
http://computeralgorithms.blogspot.com/2010/05/infix-to-rpn-notation.html
The only significant difference from strict postfix notation will be
that you'll need temp vars instead of a stack; essentially the same
problem as converting from a stack to a register file.
-JimC
--
James Cloos <cloos at jhcloos.com> OpenPGP: 1024D/ED7DAEA6
More information about the gmp-discuss
mailing list