Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Kahan summation algorithm
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Support by libraries== In general, built-in "sum" functions in computer languages typically provide no guarantees that a particular summation algorithm will be employed, much less Kahan summation.{{Citation needed|date=February 2010}} The [[BLAS]] standard for [[linear algebra]] subroutines explicitly avoids mandating any particular computational order of operations for performance reasons,<ref>[http://www.netlib.org/blas/blast-forum/ BLAS Technical Forum], section 2.7 (August 21, 2001), [https://web.archive.org/web/20040410160918/http://www.netlib.org/blas/blast-forum/chapter2.pdf#page=17 Archived on Wayback Machine].</ref> and BLAS implementations typically do not use Kahan summation. The standard library of the [[Python (programming language)|Python]] computer language specifies an [https://docs.python.org/library/math.html#math.fsum fsum] function for accurate summation. Starting with Python 3.12, the built-in "sum()" function uses the Neumaier summation.<ref>[https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes What's New in Python 3.12].</ref> In the [[Julia (programming language)|Julia]] language, the default implementation of the <code>sum</code> function does [[pairwise summation]] for high accuracy with good performance,<ref>[https://github.com/JuliaLang/julia/pull/4039 RFC: use pairwise summation for sum, cumsum, and cumprod], github.com/JuliaLang/julia pull request #4039 (August 2013).</ref> but an external library provides an implementation of Neumaier's variant named <code>sum_kbn</code> for the cases when higher accuracy is needed.<ref>[https://github.com/JuliaMath/KahanSummation.jl KahanSummation library] in Julia.</ref> In the [[C Sharp (programming language)|C#]] language, [https://www.nuget.org/packages/HPCsharp HPCsharp nuget package] implements the Neumaier variant and [[pairwise summation]]: both as scalar, data-parallel using [[SIMD]] processor instructions, and parallel multi-core.<ref>[https://github.com/DragonSpit/HPCsharp HPCsharp nuget package of high performance algorithms].</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)