double SampleInterval = (PopulationValue - valueOfSignItems) / (SampleSize - noOfSignItems);
if my divisor = 0, sampleInterval wil bcom infinity and it will be = NaN if both dividend and divisor are = 0
i need to do my code when SampleInterval = infinity and in another context when SampleInterval = NaN. How it is possible..?? can any one tel me how can i compare a decinmal value to infinity or to NaN.?
You must use the Double.IsInfinity() and Double.IsNaN() methods.
if (Double.IsInfinity(SampleInterval))
{
//TODO
}
if (Double.IsNaN(SampleInterval))
{
//TODO
}
Don't compare directly to Double.NaN, it will always return false.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With