sec fixes
This commit is contained in:
28
Matrices.cs
28
Matrices.cs
@@ -79,8 +79,32 @@ namespace Lab
|
||||
{
|
||||
for (int col = 0; col < cols; col++)
|
||||
{
|
||||
double num = (double)dt.Rows[row][col];
|
||||
num = double.IsInfinity(num) || double.IsNaN(num) ? 0 : num;
|
||||
object cell = dt.Rows[row][col];
|
||||
|
||||
double num = 0;
|
||||
|
||||
if (cell is null || cell == DBNull.Value)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else if (cell is double d)
|
||||
{
|
||||
num = d;
|
||||
}
|
||||
else if (cell is int i)
|
||||
{
|
||||
num = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Parsers.TryParseDouble(cell.ToString(), out num)) num = 0;
|
||||
}
|
||||
|
||||
if (double.IsNaN(num) || double.IsInfinity(num)) num = 0;
|
||||
|
||||
if (num > int.MaxValue) num = int.MaxValue;
|
||||
if (num < int.MinValue) num = int.MinValue;
|
||||
|
||||
array[row, col] = Convert.ToInt32(num);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user