bugGNU Octave - Bugs: bug #38292, binopdf(0,n,0) gives NaN instead...

 
 

bug #38292: binopdf(0,n,0) gives NaN instead of 1

Submitter:  None
Submitted:  Sat 09 Feb 2013 07:31:30 PM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Arie ten Cate Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.2.4
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 14 Feb 2013 05:57:14 AM UTC, comment #6: 

I added special testing for these boundary value cases to ensure compatibility with Matlab (http://hg.savannah.gnu.org/hgweb/octave/rev/444de2c0af0e).  To access the fix the original reporter will need to build from Mercurial sources or wait until the next major release (3.8.0).

Rik <rik5>
Group administrator
Thu 14 Feb 2013 05:12:56 AM UTC, comment #5: 

Should have posted this here as well as to the list:

>> version


ans =

7.9.0.529 (R2009b)

>> binopdf(0,0,0)


ans =

     1

>> binopdf(0,0,0.5)


ans =

     1

>> binopdf(0,0,1)


ans =

     1

>> binopdf(1,0,1)


ans =

     0

>>


Michael

Michael Godfrey <godfrey>
Group Member
Wed 13 Feb 2013 11:28:04 PM UTC, comment #4: 

I see where the problem lies.  Fixing it will require adding some special input test code. 

In order to get compatibility, What does Matlab return for


binopdf (0,0,0)

binopdf (0,0,0.5)

binopdf (0,0,1)

binopdf (1,0,1)



Rik <rik5>
Group administrator
Wed 13 Feb 2013 03:23:23 PM UTC, comment #3: 

Of course, this applies also to binopdf(n,n,1). This is by definition the same and hence must also be 1: out of n experiments, each with 100% probability of success, the are n successes.

Anonymous
Wed 13 Feb 2013 05:30:06 AM UTC, comment #2: 

Matlab returns 1

Michael Godfrey <godfrey>
Group Member
Wed 13 Feb 2013 04:13:53 AM UTC, comment #1: 

Do you have access to Matlab?  What do they return for this corner case?

Rik <rik5>
Group administrator
Sat 09 Feb 2013 07:31:30 PM UTC, original submission:  

By definition, with n > 0:

   binopdf(0,n,0) == 1

This is the probability that out of n experiments, each with zero probability of success, the are zero successes. However, Ocave gives a NaN instead of 1.

With positive but very-near-zero probability of success, Octave gives a 1. For instance:

   binopdf(0,2,1E-20) == 1

With a finite machine precision, this is correct.

  

Anonymous

 

(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 godfrey (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-02-14 rik5 CategoryNone Libraries
        StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code