We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a4cb4d2 commit f551661Copy full SHA for f551661
lib/node_modules/@stdlib/stats/base/dists/hypergeometric/variance/src/main.c
@@ -33,10 +33,11 @@
33
* // returns ~0.688
34
*/
35
double stdlib_base_dists_hypergeometric_variance( const int32_t N, const int32_t K, const int32_t n ) {
36
+ double p;
37
+
38
if ( N < 0 || K < 0 || n < 0 || N == STDLIB_CONSTANT_FLOAT64_PINF || K == STDLIB_CONSTANT_FLOAT64_PINF || K > N || n > N ) {
39
return 0.0/0.0; // NaN
40
}
- double p = (double)K / (double)N;
- double result = n * p * ( 1.0 - p ) * ( (double)(N-n) / (double)(N-1) );
41
- return result;
+ p = (double)K / (double)N;
42
+ return ( n * p * ( 1.0 - p ) * ( (double)(N-n) / (double)(N-1) ));
43
0 commit comments