...

View Full Version : overflow problem in 1 line :S



docock
04-02-2007, 10:49 AM
Hi there, I've got an overflow in this line:

<%=Round((Clng(nrOfGeenInteresse) / (Clng(nrOfGeenInteresse) + Clng(nrOfDeelnames))) * 100,2)%>%";

I've tried it with cint, int and clng..though the overflow error remains.. :S
How come ?

Roelf
04-02-2007, 11:17 AM
perhaps you can split this oneliner into a few lins, to see where it goes wrong exactly:

<%
lngNrOfGeenInteresse = Clng(nrOfGeenInteresse)
lngNrOfDeelnames = Clng(nrOfDeelnames)
quotient = lngNrOfGeenInteresse / (lngNrOfGeenInteresse + lngNrOfDeelnames)
percentage = quotient * 100
Round(percentage, 2)
%>
also you might want to spit out the values of some of these variables with response.write

Archangel
04-02-2007, 01:18 PM
Check the character length of what is being passed in. I copied your code and supplied my own numbers and it was fine until I entered a number of 10 digits, at which time I also received an overflow error.

Daemonspyre
04-02-2007, 06:08 PM
Also, check to make sure that none of your numbers is 0.

Since you are doing mathematical calculations including division. If you have a 0 as the divisor you will get an Overflow, as the dividend, a DIV BY 0 error.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum