Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Error:divide by zero

Quote Reply
Error:divide by zero
Hi all,

I am experiencing a fatal error when I am trying to build. The error is an
illegal division by zero at /usr/asd/httpd/cgi-bin/test/li/nph-build.cgi,
line 439, cluster 5222. This situation just recently occured.

I think maybe in this line we can change from:
if (exists $votes{$id}) {
$values[$db_rating] = (($values[$db_rating] * $values[$db_votes]) + $rating{$id})/($values[$db_votes] + $votes{$id});

$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
to :

if (exists $votes{$id}) {
if(($values[$db_votes] + $votes{$id}) != 0){

$values[$db_rating] = (($values[$db_rating] * $values[$db_votes]) + $rating{$id})/($values[$db_votes] + $votes{$id});
}
$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
print "\tUpdating rating to $values[$db_rating] for link id $id\n";
}

Any ideas?

Cheers,

Mark

Quote Reply
Re: Error:divide by zero In reply to
Delete all the files in the ratings folder in the data folder.

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Error:divide by zero In reply to
Hi Elliot,

Where is the ratings folder. I could not find any folder name ratings. What you mean is rates folder? But there is only the index.html.

Many thanks,

Mark

Quote Reply
Re: Error:divide by zero In reply to
Yes, I mean the "rates" folder...usually this error occurs when you have outdated rating files in that folder...and many users who've come across this error have deleted the files and everything worked.

Best of luck finding a solution.

Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Error:divide by zero In reply to
When delete all the files in the rates folder it will affect to other functions.

Thanks Elliot,

Mark

Quote Reply
Re: Error:divide by zero In reply to
I already provided a sloution for this about 2 days ago. Please look down the first 20 or so thread of the Links2 forums or search for "Illegal division eval"

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/