[spambayes-dev] Mozilla SpamBayes "porting"

Miguel Vargas miguel at vargas.com
Sat Feb 21 00:31:21 EST 2004


Tim Peters wrote:

> [Miguel Vargas]
> 
>>By the way, here's the latest incarnation of my code.  I'm still
>>somewhat confused about the floor() function in chi2Q.  I understand
>>why it's not needed, so why is it in the SpamBayes code?
> 
> 
> There's no call to floor() in the entire SpamBayes codebase (let alone in
> chi2Q).  What makes you think there is?

In chi2Q you have

for i in range(1, v//2):

I thought // was floor division, that's why I had written floor(v/2).

> 
> ...
> 
> 
>>------------------------------------
>>Here's the chi2Q funcition:
>>double chi2Q (double x2, PRUint32 v) {
>>         PRUint32 i;
>>         double m = x2 / 2.0;
>>         double sum = exp(-m);
>>         double term = sum;
>>
>>	NS_ASSERTION(!(v & 1), "chi2Q called with odd value");
>>
>>         for (i=1 ; i<=v/2 ; ++i) {
> 
> 
> As covered before, this loop is going around once too often.  Sorry, no time
> for more now.
> 

I don't know how I missed that one, I'm off to test again...



More information about the spambayes-dev mailing list