note 90197 rejected from function.stats-dens-pmf-hypergeometric by danbrown

From: Date: Thu, 09 Apr 2009 15:48:37 +0000
Subject: note 90197 rejected from function.stats-dens-pmf-hypergeometric by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153026@lists.php.net to get a copy of this message
Note Submitter: belcastro at tigem dot it ---- The stats_dens_pmf_hypergeometric is not correct...substitute the function in statistic.c with the following one: PHP_FUNCTION(stats_dens_pmf_hypergeometric) { double y; double X; double M; double K; double N; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &X, &M, &K, &N) == FAILURE) { RETURN_FALSE; } if ((int)(X + M) >= (int)(K + N)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "possible division by zero - X+M >= K+N"); /* RETURN_FALSE; */ } y = (binom(K, X) * binom(M-K, N-X))/binom(M, N); //y = binom(n1, N1) * binom (n2, N2)/binom(n1 + n2, N1 + N2); RETURN_DOUBLE(y); }

« previous php.notes (#153026) next »