3.0.2 release (mingw32 check)

Benjamin Lindner lindnerben at gmx.net
Tue Aug 26 10:26:36 CDT 2008


John W. Eaton wrote:
> On 26-Aug-2008, Benjamin Lindner wrote:
> 
> | John W. Eaton wrote:
> | > On 26-Aug-2008, Benjamin Lindner wrote:
> | > 
> | > | I can follow your argumentation, but why does (-i) have a real part of 
> | > | (-0) and simultaneously (-1) has a imaginary part of (0) (without the 
> | > | sign) ?
> | > 
> | > -1 is stored as a real number only.  There is no imaginary part.
> | > 
> | > | The above test expects mat2str([-1/3]) to result in "-0.3333+0i".
> | > | Isn't this inconsistent?
> | > 
> | > Yes.
> | 
> | Considered a bug?
> 
> I would guess most people would say no.
>

I'd agree. Good :)

> | > | 1/3 is represented as (1/3,0) and negating it should then yield 
> | > | (-1/3,-0). This is what puzzled me about this test.
> | > 
> | > We do have pure real numbers.  1/3 is not stored as (1/3, 0).  It has
> | > no imaginary part.
> | 
> | This I know, but obviously -1/3 is expanded to a complex number,
> 
> I don't follow.  When are you thinking it is "epxanded to a complex number"?
> 

Sorry, I didn't make it clear enough.

I assumed it, because the output is printed as a complex number:

octave:1> mat2str([-1/3])
ans = -0.33333333333333331
octave:2> mat2str([-1/3,i])
ans = [-0.33333333333333331+0i;0+1i]

In the second case, -1/3 is printed as a complex number, thus I assumed 
it must be expanded. I guess [-1/3,i] is internally stored as a complex 
2x1 matrix, so every element is "expanded" to a complex number. "expand" 
might be the wrong terminus here, "convert" would be more appropriate, 
sorry.

benjamin


More information about the Octave-maintainers mailing list