Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I don't get an error when dividing by zero
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
I don't get an error when dividing by zero
Miscellaneous
Thread ID:
00977502
Message ID:
00977502
Views:
63
Hello All,

I have a table with a column named Qx, this column is calculated for every row with the use of two other columns as below :
double Lx = (double)TableLx.Rows[i][cMortTable]
double Lx1 = (double)TableLx.Rows[this.Min_Max(i + 1)][cMortTable];

MyTable.Rows[i]["Qx"] = (Lx - Lx1) / Lx;
For some rows Lx become zero but to my surprise I don't get an error or exception fault. When I view MyTable the rows are filled with nAn.

What is the logic behind this? I wanted to catch an exception (dividedbyzero or something like that) so when it is divided by zero I can replace the rows by zero instead of nan. I know I could go around this by adding a if statement....but I just don't understand why the code doesn't generate an error.javascript:MessageSubmit()


Thank you.

Zakaria al Azhar
Zakaria al Azhar
My blog on Actuaris.net
Next
Reply
Map
View

Click here to load this message in the networking platform