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


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

Submitted by:  None
Submitted on:  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

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)

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>
Project 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 = (R2009b)

>> binopdf(0,0,0)

ans =


>> binopdf(0,0,0.5)

ans =


>> binopdf(0,0,1)

ans =


>> binopdf(1,0,1)

ans =




Michael Godfrey <godfrey>
Project 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

Rik <rik5>
Project 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.

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

Matlab returns 1

Michael Godfrey <godfrey>
Project 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>
Project Administrator
Sat 09 Feb 2013 07:31:30 PM UTC, original submission:

By definition, with n > 0:
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:
With a finite machine precision, this is correct.



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

Attach Files:

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)

    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 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.3