Skip to content

achan001/fsum

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

fsum

Accurate summation using Shewchuk algorithm (assumed double-precision, round-to-nearest mode)

Filesnames NOT end with "0" used a modified Shewchuk algorithm, saving partials only if it overflow 53 bits.

All partials (except last) used up all 53 bits, generated very few partials. This allowed processing speed about 2X of original. However, partials might be over-lapping, require adding 0.0 to break it up.

Filename ends with "0" used original Shewchuk algorithm.

All partials is sorted and non-overlapping. It might generate lots of partials to sum, thus much slower.
Getting the final sum involved loops (in reverse), slightly more complicated than my modified version

Update: fsum0.lua (and C/Cpp code) added a step to reduce number of partials, down to almost half.
The partials, however, might have 0.0 between 2 non-zero partials.
Non-zero partials still have property of sorted and non-overlapping.
With much less partials to sum, the speed is just slightly (~ 20%) slower than fsum.lua.

For C/C++ codes: see issue: Minimum Working Example
For Lua codes: see Setting Float Precision in Lua.c

This is an example for calculating 1000!

About

accurate summation using Shewchuk algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published