# Now recursively generate the ternary tree. # (Note that the terms are the same in each branch except for sign.) # Branch 1 (+-+): $i = $a - 2*$b + 2*$h; $j = 2*$a - $b + 2*$h; $k = 2*$a - 2*$b + 3*$h; &generate($i,$j,$k); # Branch 2 (+++): $i = $a + 2*$b + 2*$h; $j = 2*$a + $b + 2*$h; $k = 2*$a + 2*$b + 3*$h; &generate($i,$j,$k); # Branch 3 (-++): $i = -$a + 2*$b + 2*$h; $j = -2*$a + $b + 2*$h; $k = -2*$a + 2*$b + 3*$h; &generate($i,$j,$k); #### # Now recursively generate the ternary tree. # (Note that the terms are the same in each branch except for sign.) # Code to test whether bigint is mainly slowed by multiplies. $a2 = $a + $a; $b2 = $b + $b; $h2 = $h + $h; $h3 = $h + $h2; # Branch 1 (+-+): $i = $a - $b2 + $h2; $j = $a2 - $b + $h2; $k = $a2 - $b2 + $h3; &generate($i,$j,$k); # Branch 2 (+++): $i = $a + $b2 + $h2; $j = $a2 + $b + $h2; $k = $a2 + $b2 + $h3; &generate($i,$j,$k); # Branch 3 (-++): $i = -$a + $b2 + $h2; $j = -$a2 + $b + $h2; $k = -$a2 + $b2 + $h3; &generate($i,$j,$k);