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: 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 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 =

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

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

Matlab returns 1

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

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

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 14 Feb 2013 05:57:14 AM UTCrik5CategoryNone=>Libraries
      StatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup