Complex array converted into real when all numebers are 0+0i

John W. Eaton jwe at octave.org
Fri Jul 24 06:50:29 CDT 2009


On 24-Jul-2009, nicolas wrote:

| Bug report for Octave 3.2.2 configured for i686-pc-linux-gnu
| 
| Description:
| -----------
| 
|   * Array containing complex numbers equal to 0 + 0i are converted into real
| 
| Repeat-By:
| ---------
| 
|   * Normal behaviour
|     octave:1> complex(0,0)
|     ans =  0 + 0i
| 
|     Converted into real
|     octave:2> [complex(0,0)]
|     ans = 0
| 
|     When a complex different of 0+0i is in the array, ok
|     octave:3> [complex(0,0), complex(0,1)]
|     ans =
|        0 + 0i   0 + 1i
|  
|     When all numbers are 0+0i converted again to real
|     octave:4> [complex(0,0), complex(0,0)]
|     ans =
|        0   0
| 
|     Explicit is working
|     octave:5> complex([complex(0,0), complex(0,0)])
|     ans =
|        0 + 0i   0 + 0i

I checked in the following change.

  http://hg.savannah.gnu.org/hgweb/octave/rev/1fddcf651559

Jaroslav, maybe this would be OK for future 3.2.x releases?

Thanks,

jwe


More information about the Bug-octave mailing list