Merge pull request #4587 from wilzbach/test-codecov

show code coverage with Codecov.io
This commit is contained in:
Walter Bright 2016-07-27 23:27:09 -07:00 committed by GitHub
commit aa017e5001
2 changed files with 26 additions and 14 deletions

View file

@ -1934,10 +1934,10 @@ result is greater than or equal to $(D max).
ElementType!Range entropy(Range)(Range r) if (isInputRange!Range)
{
Unqual!(typeof(return)) result = 0.0;
foreach (e; r)
for (;!r.empty; r.popFront)
{
if (!e) continue;
result -= e * log2(e);
if (!r.front) continue;
result -= r.front * log2(r.front);
}
return result;
}
@ -1948,10 +1948,10 @@ if (isInputRange!Range &&
!is(CommonType!(ElementType!Range, F) == void))
{
Unqual!(typeof(return)) result = 0.0;
foreach (e; r)
for (;!r.empty; r.popFront)
{
if (!e) continue;
result -= e * log2(e);
if (!r.front) continue;
result -= r.front * log2(r.front);
if (result >= max) break;
}
return result;