# 65(61) operations (5 + 13 + 47(43))

**Task 1** -- Max(A,B)

    RESULT = A + (B - A) * (A <= B)

This is the obvious solution. You need the assignment, you need comparison, you need to multiply the comparison with something, the multiplicand cannot be one of the variables and the product cannot be the result.

**Task 2** -- Mid(A,B,C)

    RESULT = A                               \
           + (B - A) * (A > B) ^ (B <= C)    \
           + (C - A) * (A > C) ^ (C <  B)

This is an improvement over my previous 15-op solution, which conditioned all three variables - this saved two subtractions, but it introduced another centrality test. The test itself is simple: an element is in the middle iff exactly one other of the two is above.

**Task 3** -- sqrt(A)

    X1     = 1024 + A / 2048
    X2     = (X1  + A / X1 ) / 2
    ...
    X10    = (X9 + A / X9 ) / 2
    RESULT = X16 - (X16 * X16 > A)

Eleven rounds of newton approximation. The magic constant of 1024 is already beaten by [WolframW](https://codegolf.stackexchange.com/a/12516/7209) (and 512 causes division by zero for a=0 before a=2**32 converges), but if we can define 0/0 as zero, ten iterations will work with the starting value of 512. I do admit that my claim of ten iterations is not entirely clean, but I still claim them in parentheses. <del> I'll have to investigate if nine is possible, however.</del> WolframH's solution _is_ nine iterations.