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: LibrariesSeverity: 1 - Wish
Priority: 3 - LowItem Group: Matlab Compatibility
Status: ConfirmedAssigned to: None
Originator Name: Clemens BuchacherOpen/Closed: Open
Release: devOperating 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 File(s):

No files currently attached


Depends on the following items: None found

   bug dependencies.


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

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

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 22 Jun 2015 03:57:33 PM UTCmtmillerSeverity3 - Normal=>1 - Wish
      Priority5 - Normal=>3 - Low
      SummaryConversion from complex double to int32=>Complex integer types are not yet implemented
    Mon 22 Jun 2015 03:56:46 PM UTCmtmillerDependencies-=>bugs #45373 is dependent
    Fri 10 May 2013 02:18:22 PM UTCjordighOpen/ClosedClosed=>Open
    Fri 10 May 2013 02:16:57 PM UTCjordighStatusNone=>Confirmed

    Back to the top

    Powered by Savane 3.1-cleanup1