...

View Full Version : overflow?



Mhtml
08-01-2002, 08:55 AM
I'm making a small calculator project which will write the amount of fence posts needed for a fence on my parents farm depending on the input from the form. .

Here is what I'm using.

<%
dim PostNo 'The variable for the number of posts
dim PostSp 'The variable for spacing between posts
dim PaceAm 'The variable for the amount of paces
dim PaceSz 'The variable for the size of the paces

PostSp = Request.Form("fPostSp")
PaceAm = Request.Form("fPaceAm")
PaceSz = Request.Form("fPaceSz")

PostNo = PaceAm*PaceSz/PostSp

Response.Write(PostNo)
%>

I get an error stating overflow. What does it mean? Is it that the variable has to much information?:confused:

glenngv
08-01-2002, 09:10 AM
what's the expected value of PostNo?

Mhtml
08-01-2002, 09:24 AM
Not quite clear on what you mean.

glenngv
08-01-2002, 09:29 AM
when you ran the code, what is supposed to be the value of PostNo variable, is it too big?

Mhtml
08-02-2002, 09:30 AM
PostNo is supposed to hold the result of the calculation.

Mhtml
08-02-2002, 09:37 AM
I've tried multiple ways but I can seem to devide the number which I have stored in a variable.

Simply I times two numbers together and then divide the answer but I get an overflow error when I try to divide.

allida77
08-02-2002, 03:47 PM
Is it just an "overflow" error, try putting an --> On Error Resume Next at the beginning of your code.

oracleguy
08-02-2002, 11:28 PM
This is the page I made up and it appears to work. I added some validation in because without it, if one of the variables is empty it errors out.



<HEAD>
<TITLE>Fence post calculator</TITLE>
</HEAD>

<BODY>

<p>
<FORM action="" Method="Post">
Spacing between posts:<INPUT type="text" name="fPostSp"><BR>
Ammount of paces:<INPUT type="text" name="fPaceAm"><BR>
Size of paces:<INPUT type="text" name="fPaceSz"><BR><BR>

<INPUT type="Submit" value="Calculate">
</FORM>
</p>

<%
dim PostNo 'The variable for the number of posts
dim PostSp 'The variable for spacing between posts
dim PaceAm 'The variable for the amount of paces
dim PaceSz 'The variable for the size of the paces

PostSp = Request.Form("fPostSp")
PaceAm = Request.Form("fPaceAm")
PaceSz = Request.Form("fPaceSz")

If PostSP > 0 And PaceAm > 0 And PaceSz > 0 Then

PostNo = PaceAm*PaceSz
PostNo=PostNo/PostSp
%>

<p><%=PostNo%> required posts.</p>
<%End If%>

</BODY>

Feyd
08-03-2002, 12:22 AM
But actually doing <p><%=PostNo%> required posts.</p> is much more entertaining than the long way :thumbsup:

Are you trying to cast a number larger than 32,000 to an integer?

I've had similar problems when dealing with regional settings for decimal seperators and the thousands, but that doesn't seem to be the case for you...

Usually you get this error when you are over the limit on Request.Form. ASP's limit for form processing is supposed to be about 100k, according to Micro$oft, it breaks down further to a max of 102,399 bytes for each field. Which, again, doesn't seem like it should be affecting you, depending on what you are sending into the form...if it is the case, however, you can always use the old dirty trick of using your own function to deal with the form handling and therefore get around the overflow fatality.

oracleguy
08-03-2002, 01:43 AM
Originally posted by Feyd
But actually doing <p><%=PostNo%> required posts.</p> is much more entertaining than the long way :thumbsup:


I usually do that... i did it that way cuz i was "adapting" his existing code. I'll change it.

whammy
08-08-2002, 01:27 AM
Probably if you used some parentheses the first way would work, too.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum