bugGNU Octave - Bugs: bug #38959, Complex integer types are not yet...


bug #38959: Complex integer types are not yet implemented

Submitted by:  Clemens Buchacher <drizzd>
Submitted on:  Fri 10 May 2013 09:58:28 AM UTC  
Category:  Libraries Severity:  1 - Wish
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Clemens Buchacher Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 20 Nov 2016 10:23:44 PM UTC, comment #4:

This issue is still present in Octave 4.2.0.

Hartmut <hardy>
Wed 24 Jun 2015 10:54:36 AM UTC, comment #3:

I found a use case for this on stack overflow (see comments to the question http://stackoverflow.com/questions/30923613/how-do-i-make-complex-int16-numbers-in-octave#comment50055152_30923613 )

> It does have to be converted to int16 to communicate with hardware. But you are right it seems that prior to computation the array is converted to double anyways.

Carnë Draug <carandraug>
Project Member
Fri 10 May 2013 03:26:20 PM UTC, comment #2:

I noticed it in one of our unit tests and worked around it by disabling the test for complex integer types. I have no real world example of usefulness.

Clemens Buchacher <drizzd>
Fri 10 May 2013 02:16:57 PM UTC, comment #1:

Alright, looks like Matlab allows complex integers, even though it doesn't allow complex integer arithmetic.

This will require a major retooling of our integer types so that we can make them all complex. If this bug is important (does a lot of Matlab code rely on being able to create complex integers?), this would be a good opportunity to revisit our stupidly boneheaded numeric class hierarchy so we can make it less boneheaded.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Fri 10 May 2013 09:58:28 AM UTC, original submission:

The int32 conversion function refuses to convert complex input:

  • Expected result:

> int32(1+1i)

ans = 1 + 1i

  • Actual result:

> int32(1+1i)

error: invalid conversion from complex scalar to int32 scalar

The complex() function does not provide a workaround, since it converts int32 input to double output:

> complex(int32(1), int32(1))

ans = 1 + 1i

> class(complex(int32(1), int32(1)))

ans = double

Conversion functions for other types do not have this issue:

> single(1+1i)

ans = 1 + 1i

Clemens Buchacher <drizzd>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by drizzd (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-06-22 mtmiller Severity3 - Normal => 1 - Wish
        Priority5 - Normal => 3 - Low
        Release3.6.4 => dev
        SummaryConversion from complex double to int32 => Complex integer types are not yet implemented
    2015-06-22 mtmiller Dependencies- => bugs #45373 is dependent
    2013-05-10 jordigh Open/ClosedClosed => Open
    2013-05-10 jordigh StatusNone => Confirmed
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3