Skip to content

Commit c8e647d

Browse files
committed
fix: updated the datatype for k
--- 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: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 2c1a04c commit c8e647d

6 files changed

Lines changed: 14 additions & 10 deletions

File tree

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,11 @@ double y = stdlib_base_dists_erlang_cdf( 2.0, 1, 1.0 );
202202
The function accepts the following arguments:
203203

204204
- **x**: `[in] double` input value.
205-
- **k**: `[in] double` shape parameter.
205+
- **k**: `[in] int32_t` shape parameter.
206206
- **lambda**: `[in] double` rate parameter.
207207

208208
```c
209-
double stdlib_base_dists_erlang_cdf( const double t, const double k, const double lambda );
209+
double stdlib_base_dists_erlang_cdf( const double t, const int32_t k, const double lambda );
210210
```
211211
212212
</section>
@@ -240,9 +240,9 @@ static double random_uniform( const double min, const double max ) {
240240
}
241241
242242
int main( void ) {
243+
double lamda;
243244
double x;
244245
int32_t k;
245-
double lamda;
246246
double y;
247247
int i;
248248

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/include/stdlib/stats/base/dists/erlang/cdf.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#ifndef STDLIB_STATS_BASE_DISTS_ERLANG_CDF_H
2020
#define STDLIB_STATS_BASE_DISTS_ERLANG_CDF_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
*/
@@ -29,7 +31,7 @@ extern "C" {
2931
/**
3032
* Evaluates the cumulative distribution function (CDF) for an Erlang distribution with shape parameter `k` and rate parameter `lambda` at a value `x`.
3133
*/
32-
double stdlib_base_dists_erlang_cdf( const double x, const double k, const double lambda );
34+
double stdlib_base_dists_erlang_cdf( const double x, const int32_t k, const double lambda );
3335

3436
#ifdef __cplusplus
3537
}

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/src/addon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
#include "stdlib/stats/base/dists/erlang/cdf.h"
2020
#include "stdlib/math/base/napi/ternary.h"
2121

22-
STDLIB_MATH_BASE_NAPI_MODULE_DDD_D( stdlib_base_dists_erlang_cdf )
22+
STDLIB_MATH_BASE_NAPI_MODULE_DID_D( stdlib_base_dists_erlang_cdf )

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/src/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "stdlib/stats/base/dists/gamma/cdf.h"
2222
#include <stdint.h>
2323

24+
2425
/**
2526
* Evaluates the cumulative distribution function (CDF) for an Erlang distribution with shape parameter `k` and rate parameter `lambda` at a value `x`.
2627
*
@@ -33,11 +34,12 @@
3334
* double y = stdlib_base_dists_erlang_cdf( 2.0, 1, 1.0 );
3435
* // returns ~0.865
3536
*/
36-
double stdlib_base_dists_erlang_cdf( const double x, const double k, const double lambda ) {
37+
double stdlib_base_dists_erlang_cdf( const double x, const int32_t k, const double lambda ) {
3738
if (
38-
!stdlib_base_is_nonnegative_integer( k )
39+
!stdlib_base_is_nonnegative_integer( k ) ||
40+
k <= 0
3941
) {
4042
return 0.0 / 0.0;
4143
}
42-
return stdlib_base_dists_gamma_cdf( x, k, lambda );
44+
return stdlib_base_dists_gamma_cdf( x, (double)k, lambda );
4345
}

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/data.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

lib/node_modules/@stdlib/stats/base/dists/erlang/cdf/test/fixtures/julia/runner.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ dir = dirname( file );
7272

7373
# Generate fixtures:
7474
x = rand( 1500 ) .* 5.0;
75-
k = round.( Int64, ( rand( 1500 ) .* 10.0 ) .+ 10.0 );
75+
k = round.( Int, ( rand( 1500 ) .* 10.0 ) .+ 10.0 );
7676
lambda = rand( 1500 ) .* 10.0;
7777
gen( x, k, lambda, "data.json" );

0 commit comments

Comments
 (0)