bugGNU Octave - Bugs: bug #56342, [octave forge] (statistics)...

 
 

bug #56342: [octave forge] (statistics) function unifrnd(0,0) returns NaN but not 0

Submitter:  Liming He <liming_he>
Submitted:  Fri 17 May 2019 09:29:41 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  lostbard
Originator Name:  Liming He Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 07 Jun 2019 03:25:50 PM UTC, comment #5: 

Closing as fixed

John Donoghue <lostbard>
Group Member
Tue 28 May 2019 12:29:31 PM UTC, comment #4: 
John Donoghue <lostbard>
Group Member
Wed 22 May 2019 01:05:11 AM UTC, comment #3: 

There was some confusion and I made a mistake submitting that patch as new functionality, I'm fairly new to Octave development.

I've created a patch against the existing unifrnd function and have attached it to this bug report.

Anthony Morast <amorast>
Tue 21 May 2019 11:00:45 PM UTC, comment #2: 

I've created a patch submission that both adds the unifrnd function to the statistics forge package and corrects this behavior.

The patch can be found here: https://savannah.gnu.org/patch/index.php?9808

Anthony Morast <amorast>
Sat 18 May 2019 06:51:01 PM UTC, comment #1: 

Changing the category to "Octave Forge Package".  A maintainer for the statistics package will need to look at this.  If you can provide a patch that would help speed things along.

Matlab isn't known for their statistics packages following academically rigorous statistics.  For reference, I checked with the R language and they also give '0' for a zero-length interval so returning the minimum limit when the interval is of zero length is correct.

An additional three BIST tests for unifrnd.m should be


%!assert (unifrnd (0,0), 0)
%!assert (unifrnd (1,1), 1)
%!assert (unifrnd (1,0), NaN)



Rik <rik5>
Group administrator
Fri 17 May 2019 09:29:41 PM UTC, original submission:  


Problem description:

The function 'unifrnd' belongs to 'octave-statistics' packages. When unifrnd(0, 0) is called, it is supposed to return 0, but it returns "NaN", which is incompatible to the result (0) from Matlab (R2017B).

Explanation of unifrnd from Matlab: 

>> help unifrnd

 unifrnd Random arrays from continuous uniform distribution.


Result from Octave (version 3.8.2, 4.2 and 4.4)

octave:1> unifrnd(0,0)
ans = NaN


Result from Matlab (R2017b):

>> unifrnd(0,0)

ans =
     0



Liming He <liming_he>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #46951:  unifrnd.patch added by amorast (1KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by amorast (Posted a comment)
  • -email is unavailable- added by lostbard (Adding package maintainer)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by liming_he (Submitted the item)
  •  

    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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-07 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-05-28 lostbard StatusPatch Reviewed Ready For Test
    2019-05-28 lostbard StatusPatch Submitted Patch Reviewed
        Assigned toNone lostbard
    2019-05-22 mtmiller StatusConfirmed Patch Submitted
    2019-05-22 amorast Attached File- Added unifrnd.patch, #46951
    2019-05-20 lostbard Carbon-Copy- Added lostbard
    2019-05-19 mtmiller Summaryfunction unifrnd(0,0) returns &quot;NaN&quot;, but not 0. [octave forge] (statistics) function unifrnd(0,0) returns NaN but not 0
    2019-05-18 rik5 CategoryOctave Function Octave Package
        Item GroupIncorrect Result Matlab Compatibility
        StatusNone Confirmed
        Release4.4.0 other

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code