float evaluation of erfi



>>>>> "Jaime" == Jaime Villate <villate at fe.up.pt> writes:

    Jaime> On 12/02/2012 07:43 AM, Raymond Toy wrote:


    Ray> For a < 0, we have z = |a|*exp(-%i*%pi/2), so
    Ray> sqrt(z^2) = sqrt(|a|^2*exp(+%i*%pi)) = |a|*exp(+%i*%pi/2).  Thus
    Ray> sqrt(z^2) = |a|*exp(+%i*%pi/2)/(a*exp(-%i*%pi/2)) = |a|/a *exp(%i*%pi)
    Ray> = 1.


    Jaime> Shouldn't this be:

    Jaime> For a < 0, we have z = |a|*exp(-%i*%pi/2),
    Jaime> so sqrt(z^2) = sqrt(|a|^2*exp(+%i*%pi)) = |a|*exp(+%i*%pi/2).

As I mentioned, that depends on whether you convert -%i*%pi to
%i*%pi.  I think most texts define the phase not to include -%pi, so
your interpretation would be correct.

In this case, this is all much easier to reason about with signed
zeroes.  Then for -a*%i, it's really +0-a*%i, which means the phase
just just slightly to the right of %pi/2, so z^2 has a phase just
below the negative real axis, and when I take the square root, I get
the original z back so that sqrt(z^2)/z = 1.

Ray