bugGNU Octave - Bugs: bug #45879, randi out of range with integer...

 
 

bug #45879: randi out of range with integer arguments

Submitted by:  Ceral Paquet <octavebugs>
Submitted on:  Sat 05 Sep 2015 01:18:57 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: Kai Torben Ohlhus <siko1056>
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

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 Jump to the original submission)

Tue 08 Sep 2015 08:44:46 AM UTC, comment #6:

The issues regarding different input data types should be fixed by the changeset now.

http://hg.savannah.gnu.org/hgweb/octave/rev/f515bac7c7c1

Update randi.m to this version:

http://hg.savannah.gnu.org/hgweb/octave/file/f515bac7c7c1/scripts/general/randi.m

Any feedback is welcome!

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Mon 07 Sep 2015 10:16:39 PM UTC, comment #5:

I confirm this function was never intended for integer input "imax". The fix from https://savannah.gnu.org/bugs/?45879#comment1 works for me too, but I think this function needs a small makeover, see https://savannah.gnu.org/bugs/?45879#comment3 .

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Mon 07 Sep 2015 07:50:49 PM UTC, comment #4:

The fix in comment #1 fix this

Avinoam Kalma <avinoam>
Project Member
Mon 07 Sep 2015 05:28:30 PM UTC, comment #3:

Another little bug.

class(randi(int32(10),'double'))
ans = int32

In Matlab the result is ans = double.

Ceral Paquet <octavebugs>
Sat 05 Sep 2015 10:24:30 PM UTC, comment #2:

I think random numbers are incredibly tricky to get right :)

http://akbar.marlboro.edu/~mahoney/courses/Fall01/computation/NumeralRecipesCpdf/c7-1.pdf

Ceral Paquet <octavebugs>
Sat 05 Sep 2015 09:08:14 PM UTC, comment #1:

The problem is in the line

in randi. Changing to

will solve the problem.
what do you think?

Avinoam Kalma <avinoam>
Project Member
Sat 05 Sep 2015 01:18:57 PM UTC, original submission:

>> max(randi(int64(100),1000,1))

ans = 101

Same result with int8, 16, 32 and unsigned.

Ceral Paquet <octavebugs>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by siko1056 (Posted a comment)
  • -unavailable- added by avinoam (Posted a comment)
  • -unavailable- added by octavebugs (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 08 Sep 2015 08:44:46 AM UTCsiko1056StatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Tue 08 Sep 2015 07:35:21 AM UTCsiko1056StatusConfirmed=>In Progress
    Mon 07 Sep 2015 10:16:39 PM UTCsiko1056StatusNone=>Confirmed
      Assigned toNone=>siko1056
      Release4.0.0=>dev

    Back to the top


    Powered by Savane 3.1-cleanup1