}\ifvoid2\setbox2=\hbox{%\opdisplay{intermediarystyle.\the\count255}%{P\the\primeindex}}%\else\setbox2=\vtop{%\hbox{\box2}\hbox{%\opdisplay{intermediarystyle.\the\count255}%{P\the\primeindex}}}\fi\opcopy{q}{NbtoDecompose}%\advance\count255 by1\setbox1=\vtop{%\hbox{\box1}\hbox{%\opdisplay{operandstyle.\the\count255}%{NbtoDecompose}}}%\else\advance\primeindex by1\fi\repeat\hbox{\box1\kern0.5\opcolumnwidth\opvline(0,0.75){\the\count255.25}\kern0.5\opcolumnwidth\box2}%\fi\endgroup\getprime{20}%\primedecomp[operandstyle.2=\red,intermediarystyle.2=\red]{252}2 5 21 2 66 32 17122337Note the use of group for the whole macro in order to protect <strong>xlop</strong> parametermodifications. Note also that void parameter aren’t allowed. It’s not abug, it’s a feature. Author thinks that a user who write brackets without anythingbetween these brackets is going to make a mistake. To obviate this43
prohibition, there is the particular parameter nil which has exactly thisrôle.Finally, note the trick{\setbox2=\box2} to obtain a void box register,and final manipulations to show the vertical rule in a easy-to-read way.The second example allow to calculates a continued fraction like:1a 0 +1a 1 +1a 2 +a 3 +···giving the sequence a 0 , a 1 , a 2 , a 3 ,... to the macro. This example gives fractionscorresponding to gold number, and square root for 2 and 3.source\begingroup\long\gdef\continuedfraction#1#2{%\let\@mirror\relax\@for\op@Nb:=#1\do{%\ifx\@mirror\relax\edef\@mirror{\op@Nb}%\else\edef\@mirror{\op@Nb,\@mirror}%\fi}%\let\Op@result\relax\@for\op@Nb:=\@mirror\do{%\ifx\Op@result\relax\opcopy{\op@Nb}{result}%\else\opexpr{\op@Nb+1/result}{result}%\fi}%\opcopy{result}{#2}%}\endgroup\continuedfraction{1,1,1,1,1,1,1,1,1,1,1,1}{r}\opprint{r}\quad\continuedfraction{1,2,2,2,2,2,2,2,2,2,2,2}{r}\opprint{r}\quad\continuedfraction{1,1,2,1,2,1,2,1,2,1,2,1}{r}\opprint{r}1.618055555 1.414213564 1.732051282It does no harm just this once, we use LATEX commands for the loop.B.3 Direct Access to NumberWhen a number is saved in a <strong>xlop</strong> variable, it is possible to process with it inmany different ways. However, in certain situations, you would creat youown macro or use external macro giving such numbers as parameter.44