Skip to content

Commit c865184

Browse files
committed
fix: remove infinity check in C implementation
--- 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: na - 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: 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: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: passed - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - 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 f551661 commit c865184

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/variance/benchmark/c/benchmark.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ static double random_uniform( const double min, const double max ) {
9494
* @return elapsed time in seconds
9595
*/
9696
static double benchmark( void ) {
97-
double elapsed;
9897
int32_t N[ 100 ];
9998
int32_t K[ 100 ];
10099
int32_t n[ 100 ];
100+
double elapsed;
101101
double v;
102102
double t;
103103
int i;
@@ -110,7 +110,7 @@ static double benchmark( void ) {
110110

111111
t = tic();
112112
for ( i = 0; i < ITERATIONS; i++ ) {
113-
v = stdlib_base_dists_hypergeometric_variance( N[ i % 100 ], K[ i % 100 ], n[ i % 100 ] );
113+
v = stdlib_base_dists_hypergeometric_variance( N[ i%100 ], K[ i%100 ], n[ i%100 ] );
114114
if ( v != v ) {
115115
printf( "should not return NaN\n" );
116116
break;

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/variance/manifest.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
"libraries": [],
3939
"libpath": [],
4040
"dependencies": [
41-
"@stdlib/math/base/napi/ternary",
42-
"@stdlib/constants/float64/pinf"
41+
"@stdlib/math/base/napi/ternary"
4342
]
4443
},
4544
{
@@ -54,7 +53,6 @@
5453
"libraries": [],
5554
"libpath": [],
5655
"dependencies": [
57-
"@stdlib/constants/float64/pinf",
5856
"@stdlib/math/base/special/ceil"
5957
]
6058
},
@@ -70,7 +68,6 @@
7068
"libraries": [],
7169
"libpath": [],
7270
"dependencies": [
73-
"@stdlib/constants/float64/pinf",
7471
"@stdlib/math/base/special/ceil"
7572
]
7673
}

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/variance/src/main.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/hypergeometric/variance.h"
20-
#include "stdlib/constants/float64/pinf.h"
2120
#include <stdint.h>
2221

2322
/**
@@ -35,7 +34,7 @@
3534
double stdlib_base_dists_hypergeometric_variance( const int32_t N, const int32_t K, const int32_t n ) {
3635
double p;
3736

38-
if ( N < 0 || K < 0 || n < 0 || N == STDLIB_CONSTANT_FLOAT64_PINF || K == STDLIB_CONSTANT_FLOAT64_PINF || K > N || n > N ) {
37+
if ( N < 0 || K < 0 || n < 0 || K > N || n > N ) {
3938
return 0.0/0.0; // NaN
4039
}
4140
p = (double)K / (double)N;

0 commit comments

Comments
 (0)