bugGNU Octave - Bugs: bug #48995, rand, rande (1.1)

 
 

bug #48995: rand, rande (1.1)

Submitter:  Ernst Reissner <ernstreissner>
Submitted:  Sat 03 Sep 2016 10:59:01 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Works For Me Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 07 Sep 2016 08:22:06 AM UTC, comment #4: 

ok.

Ernst Reissner <ernstreissner>
Tue 06 Sep 2016 10:57:27 PM UTC, comment #3: 

That does not seem to be an error in Octave or Matlab.

For any function that accepts a size argument, the argument is allowed to be a floating point number, and the truncated integer part is used as the size value (number of elements, number of columns or rows, etc).


>> size (ones (2.9))
ans =
   2   2
>> size (rand (3.8))
ans =
   3   3


The rand and rande functions take no parameter, only size. But the randg and randp functions take both a parameter and a size.


>> size (rand (2.2))
ans =
   2   2
>> size (rande (2.2))
ans =
   2   2
>> size (randg (1, 2.2))
ans =
   2   2
>> size (randp (1, 2.2))
ans =
   2   2


The randg doc string seems to be wrong, since it doesn't document the required parameter. But the behavior is correct.

Mike Miller <mtmiller>
Group Member
Tue 06 Sep 2016 10:44:13 PM UTC, comment #2: 

Ok sorry, I was in a hurry.
For example: rand(1.1) returns without an error
but if you read the docs 'help rand',
then a floating argument is not allowed.

Ernst Reissner <ernstreissner>
Tue 06 Sep 2016 09:29:29 PM UTC, comment #1: 

Sorry, I don't understand what bug you are reporting here. Can you show an example of what function call with what arguments and what the error message is?

Mike Miller <mtmiller>
Group Member
Sat 03 Sep 2016 10:59:01 PM UTC, original submission:  

whereas randg requires a real argument and so randg() does not work,
rand and rande cannot be applied to 1.1.

Should be possible applying 1 .


Ernst Reissner <ernstreissner>

 

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

Attach Files:
   
   
Comment:
   

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 mtmiller (Posted a comment)
  • -email is unavailable- added by ernstreissner (Submitted the item)
  • -email is unavailable- added by ernstreissner
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-06 mtmiller Open/ClosedOpen Closed
    2016-09-06 mtmiller CategoryNone Octave Function
        StatusNone Works For Me
    2016-09-03 ernstreissner Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code