Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I don't get an error when dividing by zero
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
I don't get an error when dividing by zero
Divers
Thread ID:
00977502
Message ID:
00977502
Vues:
62
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform