Skip to content

Commit 1d9c995

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 9edef1b commit 1d9c995

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ static double random_uniform( const double min, const double max ) {
9393
* @return elapsed time in seconds
9494
*/
9595
static double benchmark( void ) {
96-
double elapsed;
9796
int32_t N[ 100 ];
9897
int32_t K[ 100 ];
9998
int32_t n[ 100 ];
99+
double elapsed;
100100
double y;
101101
double t;
102102
int i;
@@ -109,7 +109,7 @@ static double benchmark( void ) {
109109

110110
t = tic();
111111
for ( i = 0; i < ITERATIONS; i++ ) {
112-
y = stdlib_base_dists_hypergeometric_stdev( N[ i % 100 ], K[ i % 100 ], n[ i % 100 ] );
112+
y = stdlib_base_dists_hypergeometric_stdev( N[ i%100 ], K[ i%100 ], n[ i%100 ] );
113113
if ( y != y ) {
114114
printf( "should not return NaN\n" );
115115
break;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"libpath": [],
4040
"dependencies": [
4141
"@stdlib/math/base/napi/ternary",
42-
"@stdlib/constants/float64/pinf",
4342
"@stdlib/math/base/special/sqrt"
4443
]
4544
},
@@ -55,7 +54,6 @@
5554
"libraries": [],
5655
"libpath": [],
5756
"dependencies": [
58-
"@stdlib/constants/float64/pinf",
5957
"@stdlib/math/base/special/sqrt",
6058
"@stdlib/math/base/special/ceil"
6159
]
@@ -72,7 +70,6 @@
7270
"libraries": [],
7371
"libpath": [],
7472
"dependencies": [
75-
"@stdlib/constants/float64/pinf",
7673
"@stdlib/math/base/special/sqrt",
7774
"@stdlib/math/base/special/ceil"
7875
]

lib/node_modules/@stdlib/stats/base/dists/hypergeometric/stdev/src/main.c

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

1919
#include "stdlib/stats/base/dists/hypergeometric/stdev.h"
2020
#include "stdlib/math/base/special/sqrt.h"
21-
#include "stdlib/constants/float64/pinf.h"
2221
#include <stdint.h>
2322

2423
/**
@@ -37,7 +36,7 @@ double stdlib_base_dists_hypergeometric_stdev( const int32_t N, const int32_t K,
3736
double variance;
3837
double p;
3938

40-
if ( N < 0 || K < 0 || n < 0 || N == STDLIB_CONSTANT_FLOAT64_PINF || K == STDLIB_CONSTANT_FLOAT64_PINF || K > N || n > N ) {
39+
if ( N < 0 || K < 0 || n < 0 || K > N || n > N ) {
4140
return 0.0/0.0; // NaN
4241
}
4342
p = (double)K / (double)N;

0 commit comments

Comments
 (0)