On Wednesday, July 22, 2015 at 9:40:47 AM UTC-4, David P. Sanders wrote: > > How about > > mysqrt(x::Real) = sqrt(complex(x)) > mysqrt(x::Complex) = sqrt(x) >
Just mysqrt(x) = sqrt(complex(x)) should be sufficient if you always want a complex result. complex(x) is a no-op if x is already complex. But it would probably be clearer just to write sqrt(complex(x)) where that is what you want.