Saturday, September 28, 2013

Why sum is not 6 with this parallel algorithm

This particular issue is primarily caused by n not being a power of 2, it's not strictly related to floating point. Even if you use integers you still have this problem because 3 / (1 << 1) is 3 / 2 which gives 1 and what's not what you want.

No comments:

Post a Comment