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 Feb 9 19:31:30 2013  
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Arie ten CateOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 3.2.4
Operating System: Microsoft Windows

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


(Jump to the original submission Jump to the original submission)

Thu Feb 14 05:57:14 2013, 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 Feb 14 05:12:56 2013, 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 Feb 13 23:28:04 2013, 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 Feb 13 15:23:23 2013, 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 Feb 13 05:30:06 2013, comment #2:

Matlab returns 1

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

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

Rik <rik5>
Project Administrator
Sat Feb 9 19:31:30 2013, 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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by godfrey (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Feb 14 05:57:14 2013rik5CategoryNone=>Libraries

    Back to the top

    Powered by Savane 3.1-cleanup1