Skip to content

Commit e8115c0

Browse files
fix: changes in example and other files
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: passed - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: passed - task: run_c_benchmarks status: passed - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: passed - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent a901d40 commit e8115c0

File tree

8 files changed

+23
-51
lines changed

8 files changed

+23
-51
lines changed

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ for ( i = 0; i < 10; i++ ) {
171171

172172
#### stdlib_base_dists_geometric_logcdf( x, p )
173173

174-
Evaluates evaluating the logarithm of the [cumulative distribution function][cdf] of a [geometric][geometric-distribution] distribution with success probability `p`
174+
Evaluates the logarithm of the [cumulative distribution function][cdf] of a [geometric][geometric-distribution] distribution with success probability `p`
175175

176176
```c
177177
double out = stdlib_base_dists_geometric_logcdf( 2.0, 0.5 );
@@ -207,7 +207,6 @@ double stdlib_base_dists_geometric_logcdf( const double x, const double p );
207207
208208
```c
209209
#include "stdlib/stats/base/dists/geometric/logcdf.h"
210-
#include "stdlib/constants/float64/eps.h"
211210
#include <stdlib.h>
212211
#include <stdio.h>
213212
#include <math.h>
@@ -225,7 +224,7 @@ int main( void ) {
225224
226225
for ( i = 0; i < 25; i++ ) {
227226
x = random_uniform( 0, 40 );
228-
p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
227+
p = random_uniform( 0.0, 1.0 );
229228
y = stdlib_base_dists_geometric_logcdf( x, p );
230229
printf( "x: %lf, p: %lf, ln(F(x;p)): %lf\n", x, p, y );
231230
}

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/benchmark/benchmark.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ var bench = require( '@stdlib/bench' );
2424
var Float64Array = require( '@stdlib/array/float64' );
2525
var randu = require( '@stdlib/random/base/randu' );
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
27-
var EPS = require( '@stdlib/constants/float64/eps' );
2827
var pkg = require( './../package.json' ).name;
2928
var logcdf = require( './../lib' );
3029

@@ -43,7 +42,7 @@ bench( pkg, function benchmark( b ) {
4342
p = new Float64Array( len );
4443
for ( i = 0; i < len; i++ ) {
4544
x[ i % len ] = randu()*40.0;
46-
p[ i % len ] = ( randu()*1.0 ) + EPS;
45+
p[ i % len ] = ( randu()*1.0 );
4746
}
4847

4948
b.tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/benchmark/benchmark.native.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ var bench = require( '@stdlib/bench' );
2525
var Float64Array = require( '@stdlib/array/float64' );
2626
var randu = require( '@stdlib/random/base/randu' );
2727
var isnan = require( '@stdlib/math/base/assert/is-nan' );
28-
var EPS = require( '@stdlib/constants/float64/eps' );
2928
var tryRequire = require( '@stdlib/utils/try-require' );
3029
var pkg = require( './../package.json' ).name;
3130

@@ -52,7 +51,7 @@ bench( pkg+'::native', opts, function benchmark( b ) {
5251
p = new Float64Array( len );
5352
for ( i = 0; i < len; i++ ) {
5453
x[ i % len ] = randu()*40.0;
55-
p[ i % len ] = ( randu()*1.0 ) + EPS;
54+
p[ i % len ] = ( randu()*1.0 );
5655
}
5756

5857
b.tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/benchmark/c/benchmark.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dists/geometric/logcdf.h"
20-
#include "stdlib/constants/float64/eps.h"
2120
#include <stdlib.h>
2221
#include <stdio.h>
2322
#include <math.h>
@@ -102,7 +101,7 @@ static double benchmark( void ) {
102101

103102
for ( i = 0; i < 100; i++ ) {
104103
x[ i ] = random_uniform( 0.0, 40.0 );
105-
p[ i ] = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
104+
p[ i ] = random_uniform( 0.0, 1.0 );
106105
}
107106

108107
t = tic();

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/examples/c/example.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "stdlib/stats/base/dists/geometric/logcdf.h"
20-
#include "stdlib/constants/float64/eps.h"
2120
#include <stdlib.h>
2221
#include <stdio.h>
2322
#include <math.h>
@@ -35,7 +34,7 @@ int main( void ) {
3534

3635
for ( i = 0; i < 25; i++ ) {
3736
x = random_uniform( 0, 40 );
38-
p = random_uniform( 0.0, 1.0 ) + STDLIB_CONSTANT_FLOAT64_EPS;
37+
p = random_uniform( 0.0, 1.0 );
3938
y = stdlib_base_dists_geometric_logcdf( x, p );
4039
printf( "x: %lf, p: %lf, ln(F(x;p)): %lf\n", x, p, y );
4140
}

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/include/stdlib/stats/base/dists/geometric/logcdf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
* Evaluates the logarithm of the cumulative distribution function (LOGCDF) for the geometric distribution with probability parameter p.
30+
* Evaluates the logarithm of the cumulative distribution function (LOGCDF) for the geometric distribution with probability `p` at a value `x`.
3131
*/
3232
double stdlib_base_dists_geometric_logcdf( const double x, const double p );
3333

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/manifest.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"libpath": [],
6161
"dependencies": [
6262
"@stdlib/math/base/assert/is-nan",
63-
"@stdlib/constants/float64/eps",
6463
"@stdlib/constants/float64/pinf",
6564
"@stdlib/constants/float64/ninf",
6665
"@stdlib/math/base/special/log1p",
@@ -81,7 +80,6 @@
8180
"libpath": [],
8281
"dependencies": [
8382
"@stdlib/math/base/assert/is-nan",
84-
"@stdlib/constants/float64/eps",
8583
"@stdlib/constants/float64/pinf",
8684
"@stdlib/constants/float64/ninf",
8785
"@stdlib/math/base/special/log1p",

lib/node_modules/@stdlib/stats/base/dists/geometric/logcdf/src/main.c

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,49 +28,28 @@
2828
/**
2929
* Evaluates the logarithm of the cumulative distribution function (CDF) for a geometric distribution with success probability `p` at a value `x`.
3030
*
31-
* @param {number} x - input value
32-
* @param {Probability} p - success probability
33-
* @returns {number} evaluated logCDF
31+
* @param x input value
32+
* @param p success probability
33+
* @return evaluated logCDF
3434
*
3535
* @example
36-
* var y = logcdf( 2.0, 0.5 );
36+
* double y = stdlib_base_dists_geometric_logcdf( 2.0, 0.5 );
3737
* // returns ~-0.134
38-
*
39-
* @example
40-
* var y = logcdf( 2.0, 0.1 );
41-
* // returns ~-1.306
42-
*
43-
* @example
44-
* var y = logcdf( -1.0, 0.5 );
45-
* // returns -Infinity
46-
*
47-
* @example
48-
* var y = logcdf( NaN, 0.5 );
49-
* // returns NaN
50-
*
51-
* @example
52-
* var y = logcdf( 0.0, NaN );
53-
* // returns NaN
54-
*
55-
* @example
56-
* // Invalid probability
57-
* var y = logcdf( 2.0, 1.4 );
58-
* // returns NaN
5938
*/
6039
double stdlib_base_dists_geometric_logcdf( const double x, const double p ) {
61-
if (
62-
stdlib_base_is_nan( x ) ||
63-
stdlib_base_is_nan( p ) ||
64-
p < 0.0 ||
65-
p > 1.0
66-
) {
67-
return 0.0/0.0; // NaN
68-
}
69-
if ( x < 0.0 ) {
70-
return STDLIB_CONSTANT_FLOAT64_NINF;
71-
}
40+
if (
41+
stdlib_base_is_nan( x ) ||
42+
stdlib_base_is_nan( p ) ||
43+
p < 0.0 ||
44+
p > 1.0
45+
) {
46+
return 0.0/0.0; // NaN
47+
}
48+
if ( x < 0.0 ) {
49+
return STDLIB_CONSTANT_FLOAT64_NINF;
50+
}
7251
if( x == STDLIB_CONSTANT_FLOAT64_PINF ){
7352
return 0.0;
7453
}
75-
return stdlib_base_log1p( -stdlib_base_pow( 1.0 - p, stdlib_base_floor( x ) + 1.0 ) );
54+
return stdlib_base_log1p( -stdlib_base_pow( 1.0 - p, stdlib_base_floor( x ) + 1.0 ) );
7655
}

0 commit comments

Comments
 (0)