>>18
Another way would be to compute x^2 + y^2 + z^2 - min(x, y, z)^2 where min(x, y, z) is defined as follows:
x if(x <= y and x <= z)
y if(y <= x and y <= z)
z if(z <= x and z <= y)
Dunno if there's a slicker way to test for the minimum of more than simply two numbers, but it's not bad for a naive function.