I just found Project Euler, and tried to solve the first problem.
https://gist.github.com/1007840
I did four implementations: template, ctfe, parallel foreach and
parallel map.
The template implementation works on low numbers, but not on 1000
(haven't checked when it fails). It gives me the f
On 04.06.2011 14:02, simendsjo wrote:
The template implementation works on low numbers, but not on 1000
(haven't checked when it fails). It gives me the following error:
euler1.d(23): Error: template instance
euler1.SumMultiple3Or5(499LU,Below,57918LU) recursive expansion
Ehem.. Guess it fails
I just found Project Euler, and tried to solve the first problem.
https://gist.github.com/1007840
simendsjo wrote:
> I did four implementations: template, ctfe, parallel foreach and
> parallel map.
>
> The template implementation works on low numbers, but not on 1000
> (haven't checked when it fail
On 04.06.2011 20:04, Timon Gehr wrote:
ulong SumMultiple3Or5_parallel(uint below) {
ulong sum;
foreach(i; parallel(iota(below))) {
if(i % 3 == 0 || i % 5 == 0)
sum += i; // low level data race here.
}
return sum;
}
Loop iterations in a parallel foreach l
On 04/06/11 20:16, simendsjo wrote:
On 04.06.2011 20:04, Timon Gehr wrote:
ulong SumMultiple3Or5_parallel(uint below) {
ulong sum;
foreach(i; parallel(iota(below))) {
if(i % 3 == 0 || i % 5 == 0)
sum += i; // low level data race here.
}
return sum;
}
Loop iterations in a parallel foreach loop m
On 05/06/11 03:55, Ben Grabham wrote:
On 04/06/11 20:16, simendsjo wrote:
On 04.06.2011 20:04, Timon Gehr wrote:
ulong SumMultiple3Or5_parallel(uint below) {
ulong sum;
foreach(i; parallel(iota(below))) {
if(i % 3 == 0 || i % 5 == 0)
sum += i; // low level data race here.
}
return sum;
}
Loop
On Sat, 04 Jun 2011 08:11:01 -0400, simendsjo
wrote:
On 04.06.2011 14:02, simendsjo wrote:
The template implementation works on low numbers, but not on 1000
(haven't checked when it fails). It gives me the following error:
euler1.d(23): Error: template instance
euler1.SumMultiple3Or5(499LU,B