28 #if defined(X86_64) || (defined(X86) && defined(_WIN32))
41 size_t nRealSize = nSize - i;
42 size_t nUnrolledSize = nRealSize - (nRealSize % 4);
44 if (nUnrolledSize > 0)
51 for (; i + 3 < nUnrolledSize; i += 4)
59 return (sum0 + sum1) + (sum2 + sum3);
88 const double* pCurrent = pArray;
92 for (; i < nSize; ++i)
97 double fVal = fSum.
get();
98 if (!std::isfinite(fVal))
101 if (nErr == FormulaError::NoValue)
104 for (i = 0; i < nSize; i++)
106 if (!std::isfinite(pArray[i]))
109 if (nErr != FormulaError::NoValue)
KahanSum sumArray(const double *pArray, size_t nSize)
Performs the sum of an array.
This class provides LO with Kahan summation algorithm About this algorithm: https://en.wikipedia.org/wiki/Kahan_summation_algorithm For general purpose software we assume first order error is enough.
KahanSum executeSSE2(size_t &i, size_t nSize, const double *pCurrent)
FormulaError GetDoubleErrorValue(double fVal)
static KahanSum executeUnrolled(size_t &i, size_t nSize, const double *pCurrent)
If no boosts available, Unrolled KahanSum.
static KahanSum executeFast(size_t &i, size_t nSize, const double *pCurrent)
This function task is to choose the fastest method available to perform the sum.
double get() const
Returns the final sum.