Inconsistent treatment of powers of complex floats



Current Maxima (5.15) is inconsistent in its treatment of sqrt of complex
float.

         sqrt(-1.0) => 1.0*%i + 6.1e-17
    subst(-1.0,x,sqrt(x)) => 1.0*%i            !!! not the same

    (-1.0)^(1/2) => 1.0*%i

    f(x) := sqrt(x)$  f(-1.0) => 1.0*%i + 6.1e-17
    f: sqrt(x)$   f(x) := ''f$   f(-1.0) => 1.0*%i  !!! not the same

    sqrt(1.0+%i) => 0.45*%i + 1.10
    subst(1.0+%i,x,sqrt(x)) => sqrt(%i + 1.0)  !!! not even close
    (1.0+%i)^(1/2) => sqrt(%i + 1.0)

This is because simpsqrt is short-circuiting the normal simplification rules
and special-casing sqrt of a literal complex number (with flonum-eval,
similarly with big-float-eval).  This would I suppose be acceptable as an
efficiency hack (though not very good software engineering practice) if the
behavior were identical, but it is not. This breaks referential transparency
and is a very bad idea.

It *might* be a good idea to have a floating sqrt function which is distinct
from x^(1/2) -- though this would cause a multitide of other problems -- but
just having simpsqrt special-case literal float arguments is not the way to
do it.

                  -s