{{subst:subst}}#ifexpr:{{subst:#ifeq:+|-|{{subst:#expr:(1-{{{1}}}/{{{2}}}/{{{2}}}>.00000000002) or (1-{{{1}}}/{{{2}}}/{{{2}}}<-.00000000002)}}|1}}|{{subst:subst}}sqri|{{{1}}}|{{subst:#ifeq:+|-|{{subst:#expr:{{{2}}}/2+{{{1}}}/{{{2}}}/2}}|1}}}}
{{subst:#ifeq:+|-|{{{2}}}}}|{{{2}}}}}

Substituting this template produces one or more new substitution template calls, allowing recursive change of a page, see Help:Recursive conversion of wikitext.