Groups | Blog | Home
all groups > dotnet jscript > january 2006 >

dotnet jscript : Error: Overflow or underflow in the arithmetic operation


Bruce Barker
1/11/2006 10:23:09 AM
the only reason a indexOf would through an overfloaw error, would be that
the value passed as the start position, caused an overflow when its was
converted to an int. most likely you are passing a bad value.

-- bruce (sqlwork.com)


"sevilsivle" <sevilsivle.21h15z@no-mx.forums.yourdomain.com.au> wrote in
message news:sevilsivle.21h15z@no-mx.forums.yourdomain.com.au...
[quoted text, click to view]

sevilsivle
1/11/2006 1:38:24 PM

Hi,

I get a strange error in JScript aspx pages. When I call the Strin
function .indexOf I sometimes get the error 'Overflow or underflow i
the arithmetic operation'. I tried solving this error by using
dedicated function:

function ccIndexOf(aStr, aSrch, aPos, aCounter)
{
var startPos = aPos ? aPos : 0;
var counter = aCounter ? aCounter : 10;
try
{
return aStr.indexOf(aSrch, startPos);
}
catch (excp)
{
if (counter > 0)
{
counter = counter-1;
if (counter > 0)
return ccIndexOf(aStr, aSrch, startPos, counter);
}
}
return -1;
}

This seemed to workaround the problem. Unfortunately I now get the sam
error in what seems to be the integer comparison or parseInt function:
[ERROR MESSAGE LISTING]

Overflow or underflow in the arithmetic operation.
Description: An unhandled exception occurred during the execution o
the current web request. Please review the stack trace for mor
information about the error and where it originated in the code.

Exception Details: System.ArithmeticException: Overflow or underflow i
the arithmetic operation.

Source Error:


Line 5: <!--#include file="include\check.inc" -->
Line 6: <%
Line 7: var iSearchScreen
Request.QueryString("iSearchScreen")
parseInt(Request.QueryString("iSearchScreen"), 10)
(Session("iSearchScreen").Count > 0
parseInt(Session("iSearchScreen"), 10) : 1);
Line 8: var bFromToc = Request.QueryString("bFromToc")
Request.QueryString("bFromToc"):"";
Line 9: var sFirstHit = Session("iFirstHit");



Source File: D:\Inetpub\wwwroot\rechtsorde.net\iframedemo.aspx Line
7

Stack Trace:


[ArithmeticException: Overflow or underflow in the arithmeti
operation.]
Microsoft.JScript.Relational.JScriptCompare2(Object v1, Object v2
IConvertible ic1, IConvertible ic2, TypeCode t1, TypeCode t2) +1895
Microsoft.JScript.Relational.EvaluateRelational(Object v1, Objec
v2) +737
ASP.iframedemo_aspx.__Render__control1(HtmlTextWriter __output
Control parameterContainer) i
D:\Inetpub\wwwroot\rechtsorde.net\iframedemo.aspx:7
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Page.ProcessRequestMain() +1926

--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2300
ASP.NET Version:1.1.4322.2300

[ERROR MESSAGE LISTING END]

Does anyone know what causes this problem, and how I can either solv
or work-around it?

Thanks in advance,
Greetings,
Caspe

--
sevilsivl
-----------------------------------------------------------------------
sevilsivle's Profile: http://www.hightechtalks.com/m70
View this thread: http://www.hightechtalks.com/t232874
sevilsivle
1/12/2006 9:12:57 AM

Hi,

Thanks for the answer, but this is not the problem. The error occurs i
the function sometimes, with the same parameters. Refreshing the pag
often solves the problem, that's why the workaround function works
However the (similar) problem now occurs in the call of parseInt, o
the > operator (see the code snippet in the error message)

Does anyone have an idea about this?

Greetings,
Caspe

--
sevilsivl
-----------------------------------------------------------------------
sevilsivle's Profile: http://www.hightechtalks.com/m70
View this thread: http://www.hightechtalks.com/t232874
AddThis Social Bookmark Button