|
From: | Daniel J Sebald |
Subject: | Re: imag () function detail regarding -0.0000 |
Date: | Tue, 11 Sep 2012 19:53:14 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 09/11/2012 07:15 PM, Jordi GutiƩrrez Hermoso wrote:
On 11 September 2012 20:00, Daniel J Sebald<address@hidden> wrote:octave:59> [1,-1,-0]'*i ans = 0 + 1i -0 - 1i -0 - 0i Is this proper behavior? I would thinkThere is no actual "i" in Octave. Instead, "i" is a function that returns the equivalent of std::complex<double>(0.0, 1.0). You can see this behaviour in other ways, e.g. inf*i giving NaNs.
There are a few options actually: imag(y)*i complex(real(y)*0,imag(y)) complex(0,imag(y))The first has -0 reflecting the +/- pattern of the imaginary component (makes little sense). The second has -0 reflecting the +/- pattern of the real component (a little more sense). The third looks best. I'll go with the second because it is the same effect as rounding in this case.
Thanks, Dan
[Prev in Thread] | Current Thread | [Next in Thread] |