News for hackers. Stuff that matters.
Re:John Gustafson’s crusade to replace floating point with s... by dragontamer on Tuesday July 09, 2019 @10:52AM (#20392335)
If you don't care about cancellation error and are only concerned with perfect bitwise / reproducible results, then sort your numbers.

Sorting the numbers is necessary to minimize cancellation error. But absolute minimum cancellation error can only be done sequentially: the parallel version may return different results.

    l = list(s)
    l.sort()
    sum(l)
    l = list(reversed(s))
    l.sort()
    sum(l)
Both return 1.111111111111111 now. Sorting is the "synchronization" step you need to get all your parallel tasks back into a defined order.

There are no comments on this comment yet.