|
Forgot to mention, though: The more idiomatic/shorter way to write
something like this would be to perform a reduction on a
(non-parallel, lazy, random access) std.parallelism.Map. The map
function will be evaluated in parallel naturally, as the parallel
reduction is performed. Maybe this should be an example in the docs
for reduce. In your pi example: // Nested function inside main(). double calculateTerm(int i) { immutable x = (i - 0.5) * delta ; return 1.0 / (1.0 + x * x); } immutable sum = taskPool.reduce!"a + b"( std.algorithm.map!calculateTerm(iota(n)) ); On 3/3/2011 8:58 AM, David Simcha wrote: Unfortunately I already played around with this, and it seems it absolutely requires double precision, or else it blows up numerically. I want to avoid double precision in my benchmarks so that stack alignment artifacts will not creep in. |
_______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
