File tree Expand file tree Collapse file tree 5 files changed +8
-28
lines changed
stats/base/dists/bernoulli/cdf Expand file tree Collapse file tree 5 files changed +8
-28
lines changed Original file line number Diff line number Diff line change @@ -1329,9 +1329,9 @@ Out[2]: [ 'stdlib-ansi-basic', 'myTheme' ]
13291329
13301330Starts a tutorial.
13311331
1332- ``` text
1333- In [1]: var id = tutorial( 'repl' );
1334- ```
1332+ ```text
1333+ In [1]: var id = tutorial( 'repl' );
1334+ ```
13351335
13361336The function accepts the following ` options ` :
13371337
Original file line number Diff line number Diff line change 22
33@license Apache-2.0
44
5- Copyright (c) 2024 The Stdlib Authors.
5+ Copyright (c) 2018 The Stdlib Authors.
66
77Licensed under the Apache License, Version 2.0 (the "License");
88you may not use this file except in compliance with the License.
@@ -167,7 +167,7 @@ double y = stdlib_base_dists_bernoulli_cdf( 0.5, 0.5 );
167167The function accepts the following arguments
168168
169169- ** x** : ` [in] double ` input value.
170- - ** p** : ` [in] double ` success probability
170+ - ** p** : ` [in] double ` success probability.
171171
172172``` c
173173double stdlib_base_dists_bernoulli_cdf ( const double x, const double p );
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ bench( pkg+':factory', function benchmark( b ) {
8181
8282 b . tic ( ) ;
8383 for ( i = 0 ; i < b . iterations ; i ++ ) {
84- y = mycdf ( x [ i % 100 ] ) ;
84+ y = mycdf ( x [ i % len ] ) ;
8585
8686 if ( isnan ( y ) ) {
8787 b . fail ( 'should not return NaN' ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' );
2828/**
2929* Evaluates the cumulative distribution function (CDF) for a Bernoulli distribution with success probability `p` at a value `x`.
3030*
31+ * @private
3132* @param {number } x - input value
3233* @param {Probability } p - success probability
3334* @returns {Probability } evaluated CDF
Original file line number Diff line number Diff line change 2424*
2525* @param x input value
2626* @param p success probability
27- * @returns evaluated CDF
27+ * @returns expected value
2828*
2929* @example
3030* double y = stdlib_base_dists_bernoulli_cdf( 0.5, 0.5 );
3131* // returns ~0.5
32- *
33- * @example
34- * double y = stdlib_base_dists_bernoulli_cdf( 2.0, 0.1 );
35- * // returns ~1.0
36- *
37- * @example
38- * double y = stdlib_base_dists_bernoulli_cdf( -1.0, 0.3 );
39- * // returns ~0.0
40- *
41- * @example
42- * double y = stdlib_base_dists_bernoulli_cdf( NaN, 0.5 );
43- * // returns NaN
44- *
45- * @example
46- * double y = stdlib_base_dists_bernoulli_cdf( 0.0, NaN );
47- * // returns NaN
48- *
49- * @example
50- * // Invalid probability
51- * double y = stdlib_base_dists_bernoulli_cdf( 0.5, 1.4 );
52- * // returns NaN
5332*/
5433double stdlib_base_dists_bernoulli_cdf ( const double x , const double p ) {
5534 if (
You can’t perform that action at this time.
0 commit comments