Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

14.0 / (14 * 0.01) = ?

$
0
0

Hello everyone.

Got issue with calculation items success ratio. Here's source code:

List<ResponseMail> conversationsForCurrentPeriod = _responsesForCurrentPeriod;

if (conversationsForCurrentMonth.Count <= 0)
{
   return 0;
}

double successCount = conversationsForCurrentMonth.Count(obj => obj.ResponseInterval > 0);
double result = successCount / (conversationsForCurrentMonth.Count * 0.01);

return result;

So in case I got 14 records in '_responsesForCurrentPeriod' collection and all of them are successful (their ResponseInterval is greater then 0) I got successCount = 14. So the 'result' variable is calculated by operation 14.0 / (14 * 0.01). The result of this operation should be 100 but in my particular case I'm resulted with 99.999999999999986.

Please tell me whether this is a bug or what ?
Thanks in advance.



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>