Thanks Bonnie for the explanation.
>What's interesting about this, Zakaria, is that if you were to use an integer instead of a double, you *would* get the DivideByZeroException.
>
>So, since you obviously need to use double, it looks like you'll have to do the checking for zero yourself. Incidentally, that should be the preferred way of doing it anyway. Relying on an exception to catch this sort of thing is waaaaay slower than executing the if statement (of course, if you seldom run into the zero situation, then it probably ends up being slower checking every case for zero <g>).
>
>~~Bonnie
>
>
>
>>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