mirror of
https://github.com/dlang/phobos.git
synced 2025-05-08 03:56:54 +03:00
fix weird compiler error of std.numeric.entropy
This commit is contained in:
parent
f14f0dfd28
commit
11b4c1fb1e
2 changed files with 7 additions and 7 deletions
|
@ -31,6 +31,6 @@ script:
|
||||||
# test code coverage
|
# test code coverage
|
||||||
- (cd dmd && make -f posix.mak)
|
- (cd dmd && make -f posix.mak)
|
||||||
- (cd druntime && make -f posix.mak)
|
- (cd druntime && make -f posix.mak)
|
||||||
- (cd phobos && make -f posix.mak $(find std etc -name "*.d" | sed "s/[.]d$/.test/" | grep -vE '(std.encoding|net.curl)' ))
|
- (cd phobos && make -f posix.mak $(find std etc -name "*.d" | sed "s/[.]d$/.test/" | grep -vE '(std.algorithm.sorting|std.encoding|net.curl)' ))
|
||||||
after_success:
|
after_success:
|
||||||
- (cd phobos && bash <(curl -s https://codecov.io/bash))
|
- (cd phobos && bash <(curl -s https://codecov.io/bash))
|
||||||
|
|
|
@ -1923,10 +1923,10 @@ result is greater than or equal to $(D max).
|
||||||
ElementType!Range entropy(Range)(Range r) if (isInputRange!Range)
|
ElementType!Range entropy(Range)(Range r) if (isInputRange!Range)
|
||||||
{
|
{
|
||||||
Unqual!(typeof(return)) result = 0.0;
|
Unqual!(typeof(return)) result = 0.0;
|
||||||
foreach (e; r)
|
for (;!r.empty; r.popFront)
|
||||||
{
|
{
|
||||||
if (!e) continue;
|
if (!r.front) continue;
|
||||||
result -= e * log2(e);
|
result -= r.front * log2(r.front);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1937,10 +1937,10 @@ if (isInputRange!Range &&
|
||||||
!is(CommonType!(ElementType!Range, F) == void))
|
!is(CommonType!(ElementType!Range, F) == void))
|
||||||
{
|
{
|
||||||
Unqual!(typeof(return)) result = 0.0;
|
Unqual!(typeof(return)) result = 0.0;
|
||||||
foreach (e; r)
|
for (;!r.empty; r.popFront)
|
||||||
{
|
{
|
||||||
if (!e) continue;
|
if (!r.front) continue;
|
||||||
result -= e * log2(e);
|
result -= r.front * log2(r.front);
|
||||||
if (result >= max) break;
|
if (result >= max) break;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue