You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summing list sequentially and in parallel produces two different results.
The following test fails:
// summands of Leibniz formula for pivallist=0 until 10000 map { i =>BigDecimal(4) * (1- (i %2) *2) / (2* i +1) }
valpiSeq= list sum
valpiPar= list.par sum
assert(piSeq == piPar)
The text was updated successfully, but these errors were encountered:
Sanjin Sehic (saserr) said:
Additionally, replacing {{sum}} with {{reduceLeft {_ + _}}} for parallel computation returns same result as sequential one.
@soc said:
I guess even BigDecimals are not commutative under addition.
This is related to #4658, because for your actual example neither sum nor reduceLeft are necessary, because the result can be determined algorithmically.
@paulp said:
Not a bug. Create your BigDecimals with java.math.MathContext.UNLIMITED and you will get the same result from both (both will throw exceptions for non-terminating decimal expansions.) When you perform rounding operations in different orders, you get different results.
Summing list sequentially and in parallel produces two different results.
The following test fails:
The text was updated successfully, but these errors were encountered: