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


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

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

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


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

Closing as fixed

John Donoghue <lostbard>
Project MemberIn charge of this item.
Tue 28 May 2019 12:29:31 PM UTC, comment #4: 
John Donoghue <lostbard>
Project MemberIn charge of this item.
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>
Project 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 =

Liming He <liming_he>


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

Attach Files:

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)

    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 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 "NaN", but not 0. => [octave forge] (statistics) function unifrnd(0,0) returns NaN but not 0
    2019-05-18 rik5 CategoryOctave Function => Octave Forge Package
        Item GroupIncorrect Result => Matlab Compatibility
        StatusNone => Confirmed
        Release4.4.0 => other

    Back to the top

    Powered by Savane 3.5