bugGNU Octave - Bugs: bug #45143, "Infinite ranges" 1:Inf...


bug #45143: "Infinite ranges" 1:Inf in Matlab, not allowed in Octave

Submitted by:  Antonio Pino Robles <antoniopino>
Submitted on:  Tue 19 May 2015 05:59:26 PM UTC  
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  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.


( Jump to the original submission)

Thu 29 Dec 2016 05:07:09 PM UTC, comment #9:

I wanted to know whether ranges could be of different types.

In Octave, there is a range type that stores only the base, limit, and increment as double precision floating point values.

I think that in Matlab, the range syntax is just a way of creating a matrix and that there is no compact internal storage for them, though ranges used in for loops may get special treatment.

It doesn't appear to me that the issue is fixed because

"works" in Matlab by setting the upper limit of the loop range to the maximum value for an int64 value. In Octave, it is still an error.

John W. Eaton <jwe>
Project Administrator
Wed 28 Dec 2016 10:41:48 PM UTC, comment #8:

Is this issue still present in Octave 4.2.0?

When I understand comment #3 correctly, then the original (Matlab incompatibility) issue is already "fixed", because recent Matlab versions (R2015a) behave the same as Octave does in this respect.

But I have not understood the reasoning behind comment #6 and comment #7. Is this about the same issue?

Hartmut <hardy>
Wed 24 Jun 2015 07:43:37 PM UTC, comment #7:
Carnë Draug <carandraug>
Project Member
Wed 24 Jun 2015 06:59:34 PM UTC, comment #6:

What happens in Matlab for the following?

John W. Eaton <jwe>
Project Administrator
Tue 26 May 2015 03:10:39 PM UTC, comment #5:
Antonio Pino Robles <antoniopino>
Wed 20 May 2015 09:45:42 AM UTC, comment #4:

Oops, I meant leaving Octave as it is, not Matlab.

Michael Godfrey <godfrey>
Project Member
Wed 20 May 2015 08:50:36 AM UTC, comment #3:

Right. In Matlab R2015a for 1:Inf is not
equivalent to while (1). So, it would
appear that leaving Matlab as it is is the
better choice.

Michael Godfrey <godfrey>
Project Member
Wed 20 May 2015 01:00:50 AM UTC, comment #2:

I got someone to confirm this with a recent version of Matlab.

Assignment to a variable does fail with an error about it being too large to be allocated.

Looping over the range does work, but it also prints a warning about the range being truncated to 9223372036854775807 (which is intmax("int64")).

Mike Miller <mtmiller>
Project Administrator
Tue 19 May 2015 07:19:05 PM UTC, comment #1:

Confirmed, although since there are easy workarounds like using while(1) I've lowered the priority on this bug.

I assume Matlab only accepts Inf in ranges in this one special case. Does this fail?

Rik <rik5>
Project Administrator
Tue 19 May 2015 05:59:26 PM UTC, original submission:

The Inf function in Matlab can be used to generate infinite ranges and these are used to create infinite loops. That is

is equivalent to

This form of looping is currently not allowed in Octave.

Antonio Pino Robles <antoniopino>


(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 jwe (Posted a comment)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by antoniopino (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-16 lachlan Dependencies- => bugs #47174 is dependent
    2015-06-24 rik5 Carbon-CopyRemoved 72865 => -
    2015-05-20 mtmiller Release4.0.0-rc3 => dev
        Operating SystemGNU/Linux => Any
    2015-05-19 rik5 Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.3