Skip to content
Snippets Groups Projects
Commit 3575a541 authored by Shawn Samuel Carl McAdam's avatar Shawn Samuel Carl McAdam
Browse files

Added better comments

parent 72538ba6
No related branches found
No related tags found
No related merge requests found
#include <inttypes.h> // uint64_t
#include <stdio.h>
#include <stdlib.h>
#include "bin_dfs.h"
// private helper functions
......@@ -25,6 +23,8 @@ long double cdf(uint64_t k, uint64_t n, long double p){
}
// Can't do tail recursion here because the intermediate products can get
// far larger than LDBL_MAX
long double pmf_helper(uint64_t k, uint64_t n, long double p){
// work through our k's then work through our n's.
if(n == 0)
......
......@@ -19,11 +19,12 @@ long double pmf(uint64_t k, uint64_t n, long double p);
* Purpose:
* Recusively sum up the probabilities for each i<=n
* Assumptions:
* i<=n
* k <= n
* Returns:
* P(X<=i) where X~bin(n, p)
* P(X<=k) where X~bin(n, p)
* ie, \sum_{j=0}^k pmf(j, n, p)
*/
long double cdf(uint64_t i, uint64_t n, long double p);
long double cdf(uint64_t k, uint64_t n, long double p);
#endif // DIST_FUNCT_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment