Does double.IsInfinity(value) cover double.IsPositiveInfinity(value) and
double.IsNegativeInfinity(value))?
Background:
I am pulling data from CSV files and writing it a database. This runs
extremely often and I'm trying to look at this from an efficiency point of
view.
Question:
Is double.IsPositiveInfinity(value) || double.IsNegativeInfinity(value)
redundant in the following code when trying to throw out infinite values?
Code:
foreach (var word in lineWords)
{
double value;
if (!double.TryParse(word, out value) ||
double.IsNaN(value) ||
double.IsInfinity(value) ||
double.IsPositiveInfinity(value) ||
double.IsNegativeInfinity(value))
{
continue;
}
//Store value
...
}
No comments:
Post a Comment