Skip to content

Instantly share code, notes, and snippets.

@Nexuapex
Created August 23, 2012 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nexuapex/3432733 to your computer and use it in GitHub Desktop.
Save Nexuapex/3432733 to your computer and use it in GitHub Desktop.
Kahan summation (3-way)
float sum(float x0, float x1, float x2)
{
float accum = x0 + x1;
float excess = (accum - x0) - x1;
float addend = x2 - excess;
return accum + addend;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment