bugGNU Octave - Bugs: bug #57166, ones(), zeros(), pi(), e() do not...


bug #57166: ones(), zeros(), pi(), e() do not throw error when asked to create an array larger than is possible

Submitted by:  Rik <rik5>
Submitted on:  Mon 04 Nov 2019 04:31:07 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Missed Error or Warning
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.


Mon 04 Nov 2019 04:31:07 PM UTC, original submission:  

This is easiest to see if Octave has been configured with --disable-64 so that the octave_idx_type is an int32.  In that case, the largest number of elements for any dimension is intmax ("int32").  Below is an example

octave:4> format long
octave:5> N = double (intmax ("int32"))
N = 2147483647
octave:6> N = N + 100
N = 2147483747
octave:7> x = ones (N, 1, "uint8");
octave:8> numel (x)
ans = 2147483647
octave:9> diary off

The interpreter truncated the number of elements to the maximum possible, but there was no warning about that.  Bug #47468 is related, but different.

Rik <rik5>
Project Administrator


(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

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5 (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.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.6