Hi,

well, first you're taking the difference of $i1 and $i2 and then you apply the 'bitwise exclusive or' operator with the result and 2. This is certainly NOT what you wish to achieve...

The 'power' function in expr is called 'pow', so you should do expr sqrt ( pow ( $i1 - $i2 , 2 ) + pow ( $i3 - $i4 , 2 ) ). On the other hand, the power function is quite expensive computationally compared to a simple multiplication, so for squaring a value, you should better use the form

expr sqrt ( ($i1 - $i2)*($i1 - $i2) + ($i3 - $i4)*($i3 - $i4) )

HTH,

Ádám