TY - JOUR AU - Danvy, Olivier AU - Goldberg, Mayer PY - 1997/01/01 Y2 - 2024/03/28 TI - Partial Evaluation of the Euclidian Algorithm (Extended Version) JF - BRICS Report Series JA - BRICS VL - 4 IS - 1 SE - Articles DO - 10.7146/brics.v4i1.18780 UR - https://tidsskrift.dk/brics/article/view/18780 SP - AB - Some programs are easily amenable to partial evaluation because<br />their control flow clearly depends on one of their parameters. Specializing<br />such programs with respect to this parameter eliminates the<br />associated interpretive overhead. Some other programs, however, do<br />not exhibit this interpreter-like behavior. Each of them presents a challenge<br />for partial evaluation. The Euclidian algorithm is one of them,<br />and in this article, we make it amenable to partial evaluation.<br />We observe that the number of iterations in the Euclidian algorithm<br />is bounded by a number that can be computed given either of the two<br />arguments. We thus rephrase this algorithm using bounded recursion.<br />The resulting program is better suited for automatic unfolding and<br />thus for partial evaluation. Its specialization is efficient.<br />Keywords: partial evaluation, scientific computation. ER -