|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey, thanks for all of your helping in the past.....now im stuck on this one. Ok so this is what i have to do
F.E. = T - t ------ x100 T where T = is the last operation's timing t = is the first operation's timing So i coded it all in one line like this: Code:
Session("feugene") = ((Session("fop10")-Session("fop1"))/Session("fop10"))*100
And that returned "overflow" error... so i checked once and again and i couldnt find a mistake on a parenthesis or nothing like that. So i ended up doing it all step by step like this: Code:
Session("feugene") = Session("fop10")-Session("fop1")
Session("feugene") = Session("feugene")/Session("fop10")
Session("feugene") = Session("feugene")*100
and it's still saying i have an error on the line that refers to the division. I am using 'double' values on the inputs.. and i also tried to use the cdbl function before each variable and it wont work either. Does anyone have an idea of what's going on? Sorry if dumb post, but this is driving me nuts.. thanks |
|
#2
|
|||
|
|||
|
Print the value of Session("fop10") with Response.Write and make sure it's not 0.
__________________
ASP ASP hosting SQL Tutorial SQL Strings Loans Canada C D SQL Dictionary Hosting Dictionary Tech Dictionary Job Bank Canada |
|
#3
|
|||
|
|||
|
Here is what I would try
<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0"> </HEAD> <BODY> <% Session("fop1") = 0 Session("fop10") = -1 if Session("fop10") = 0 then 'can not divide by zero session("feugene") = 0 Else Session("feugene") = cdouble(Session("fop10"))-cdouble(Session("fop1")) Session("feugene") = cdouble(Session("feugene"))/cdouble(Session("fop10")) Session("feugene") = cdouble(Session("feugene"))*100 end if Response.write session("feugene") %> </BODY> </HTML> <% Public Function CDouble(value) CDouble = 0.0 If VarType(value) = vbBoolean Then If value Then CDouble = 1.0 End If Exit Function End If On Error Resume Next CDouble = CDbl(value) End Function %> Bob@lyrex.com |
|
#4
|
|||
|
|||
|
Thanks for your reply spungebob..
i capture the values of the variables with textfields, so i put the inputs and none of the inputs are 0... i still keep getting that error.. i feel like the dumbest person in the world!!! =( |
|
#5
|
|||
|
|||
|
I would like to give this thread a bump to the top because I am also having this problem.
For me, I have 2 variables which are sumations and have the following code: Code:
dWinchCatTotalShiftsWorked = cdbl(dWinchCatTotalShiftsWorked) + cdbl(dValue)
dWinchCatUtilizationTotalShiftsAvailable = cdbl(dWinchCatUtilizationTotalShiftsAvailable) + cdbl(rsDetails("ShiftsAvailable"))
When I use response.write on these variables I get 6 and 8 respectively. When I response.write the TypeName of these variables, I get the value double for both. Now, when I divide dWinchCatTotalShiftsWorked by dWinchCatUtilizationTotalShiftsAvailable as in the following: Code:
Response.Write(dWinchCatTotalShiftsWorked/dWinchCatUtilizationTotalShiftsAvailable) Response.Write(6/8) I get the Microsoft VBScript runtime (0x800A0006) Overflow error. The second statement works just fine and returns 0.75 Now how is it that division using the variables causes an overflow error? a CDbl should easily handle a value of 0.75 Ponderous man. Really ponderous. |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Overflow when trying to divide :( |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|