Skip to content

Commit ff66b78

Browse files
feat: added new implementation and other minor updates
--- 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: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - 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: passed ---
1 parent 5148c42 commit ff66b78

File tree

15 files changed

+48
-57
lines changed

15 files changed

+48
-57
lines changed

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ for ( i = 0; i < 10; i++ ) {
167167

168168
#### stdlib_base_dists_binomial_skewness( n, p )
169169

170-
Returns the skewness of a binomial distribution.
170+
Returns the [skewness][skewness] of a [binomial][binomial-distribution] distribution with number of trials `n` and success probability `p`.
171171

172172
```c
173173
double out = stdlib_base_dists_binomial_skewness( 100, 0.1 );
@@ -176,11 +176,11 @@ double out = stdlib_base_dists_binomial_skewness( 100, 0.1 );
176176

177177
The function accepts the following arguments:
178178

179-
- **n**: `[in] int` number of trials.
179+
- **n**: `[in] int32_t` number of trials.
180180
- **p**: `[in] double` success probability.
181181

182182
```c
183-
double stdlib_base_dists_binomial_skewness( const int n, const double p );
183+
double stdlib_base_dists_binomial_skewness( const int32_t n, const double p );
184184
```
185185
186186
</section>
@@ -205,6 +205,7 @@ double stdlib_base_dists_binomial_skewness( const int n, const double p );
205205
#include "stdlib/stats/base/dists/binomial/skewness.h"
206206
#include "stdlib/math/base/special/ceil.h"
207207
#include <stdlib.h>
208+
#include <stdint.h>
208209
#include <stdio.h>
209210
210211
static double random_uniform( const double min, const double max ) {
@@ -213,16 +214,16 @@ static double random_uniform( const double min, const double max ) {
213214
}
214215
215216
int main( void ) {
216-
double n;
217+
int32_t n;
217218
double p;
218219
double y;
219220
int i;
220221
221222
for ( i = 0; i < 25; i++ ) {
222-
n = stdlib_base_ceil( random_uniform( 0, 100 ) );
223-
p = random_uniform( 0, 1 );
223+
n = stdlib_base_ceil( random_uniform( 0.0, 100.0 ) );
224+
p = random_uniform( 0.0, 1.0 );
224225
y = stdlib_base_dists_binomial_skewness( n, p );
225-
printf( "n: %lf, p: %lf, skew(X;n,p): %lf\n", n, p, y );
226+
printf( "n: %d, p: %lf, skew(X;n,p): %lf\n", n, p, y );
226227
}
227228
228229
return 0;

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/benchmark/benchmark.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var Float64Array = require( '@stdlib/array/float64' );
2524
var ceil = require( '@stdlib/math/base/special/ceil' );
25+
var Int32Array = require( '@stdlib/array/int32' );
26+
var Float64Array = require( '@stdlib/array/float64' );
2627
var randu = require( '@stdlib/random/base/randu' );
2728
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2829
var pkg = require( './../package.json' ).name;
@@ -39,10 +40,10 @@ bench( pkg, function benchmark( b ) {
3940
var i;
4041

4142
len = 100;
42-
n = new Float64Array( len );
43+
n = new Int32Array( len );
4344
p = new Float64Array( len );
4445
for ( i = 0; i < len; i++ ) {
45-
n[ i ] = ceil( randu()*100.0 );
46+
n[ i ] = ceil( randu() * 100.0 );
4647
p[ i ] = randu();
4748
}
4849

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/benchmark/benchmark.native.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2024 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25+
var Int32Array = require( '@stdlib/array/int32' );
2526
var Float64Array = require( '@stdlib/array/float64' );
2627
var tryRequire = require( '@stdlib/utils/try-require' );
2728
var ceil = require( '@stdlib/math/base/special/ceil' );
@@ -48,10 +49,10 @@ bench( pkg+'::native', opts, function benchmark( b ) {
4849
var i;
4950

5051
len = 100;
51-
n = new Float64Array( len );
52+
n = new Int32Array( len );
5253
p = new Float64Array( len );
5354
for ( i = 0; i < len; i++ ) {
54-
n[ i ] = ceil( randu()*100.0 );
55+
n[ i ] = ceil( randu() * 100.0 );
5556
p[ i ] = randu();
5657
}
5758

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/benchmark/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2024 The Stdlib Authors.
4+
# Copyright (c) 2025 The Stdlib Authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/benchmark/c/benchmark.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2024 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/binomial/skewness.h"
2020
#include "stdlib/math/base/special/ceil.h"
2121
#include <stdlib.h>
22+
#include <stdint.h>
2223
#include <stdio.h>
2324
#include <math.h>
2425
#include <time.h>
@@ -94,15 +95,15 @@ static double random_uniform( const double min, const double max ) {
9495
*/
9596
static double benchmark( void ) {
9697
double elapsed;
97-
double n[ 100 ];
98+
int32_t n[ 100 ];
9899
double p[ 100 ];
99100
double y;
100101
double t;
101102
int i;
102103

103104
for ( i = 0; i < 100; i++ ) {
104-
n[ i ] = stdlib_base_ceil( random_uniform( 0, 100 ) );
105-
p[ i ] = random_uniform( 0, 1 );
105+
n[ i ] = stdlib_base_ceil( random_uniform( 0.0, 100.0 ) );
106+
p[ i ] = random_uniform( 0.0, 1.0 );
106107
}
107108

108109
t = tic();

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/binding.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @license Apache-2.0
22
#
3-
# Copyright (c) 2024 The Stdlib Authors.
3+
# Copyright (c) 2025 The Stdlib Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/examples/c/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#/
22
# @license Apache-2.0
33
#
4-
# Copyright (c) 2024 The Stdlib Authors.
4+
# Copyright (c) 2025 The Stdlib Authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/examples/c/example.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2024 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@
1919
#include "stdlib/stats/base/dists/binomial/skewness.h"
2020
#include "stdlib/math/base/special/ceil.h"
2121
#include <stdlib.h>
22+
#include <stdint.h>
2223
#include <stdio.h>
2324

2425
static double random_uniform( const double min, const double max ) {
@@ -27,16 +28,16 @@ static double random_uniform( const double min, const double max ) {
2728
}
2829

2930
int main( void ) {
30-
double n;
31+
int32_t n;
3132
double p;
3233
double y;
3334
int i;
3435

3536
for ( i = 0; i < 25; i++ ) {
36-
n = stdlib_base_ceil( random_uniform( 0, 100 ) );
37-
p = random_uniform( 0, 1 );
37+
n = stdlib_base_ceil( random_uniform( 0.0, 100.0 ) );
38+
p = random_uniform( 0.0, 1.0 );
3839
y = stdlib_base_dists_binomial_skewness( n, p );
39-
printf( "n: %lf, p: %lf, skew(X;n,p): %lf\n", n, p, y );
40+
printf( "n: %d, p: %lf, skew(X;n,p): %lf\n", n, p, y );
4041
}
4142

4243
return 0;

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/include.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @license Apache-2.0
22
#
3-
# Copyright (c) 2024 The Stdlib Authors.
3+
# Copyright (c) 2025 The Stdlib Authors.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/binomial/skewness/include/stdlib/stats/base/dists/binomial/skewness.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2024 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@
1919
#ifndef STDLIB_STATS_BASE_DISTS_BINOMIAL_SKEWNESS_H
2020
#define STDLIB_STATS_BASE_DISTS_BINOMIAL_SKEWNESS_H
2121

22+
#include <stdint.h>
23+
2224
/*
2325
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
2426
*/
@@ -27,9 +29,9 @@ extern "C" {
2729
#endif
2830

2931
/**
30-
* Returns the skewness of a binomial distribution.
32+
* Returns the skewness of a binomial distribution with number of trials `n` and success probability `p`.
3133
*/
32-
double stdlib_base_dists_binomial_skewness( const double n, const double p );
34+
double stdlib_base_dists_binomial_skewness( const int32_t n, const double p );
3335

3436
#ifdef __cplusplus
3537
}

0 commit comments

Comments
 (0)