Public Member Functions | |
Accumulator (Accumulator a) | |
Accumulator (double y) | |
void | Add (double y) |
void | Negate () |
void | Set (double y) |
double | Sum () |
double | Sum (double y) |
Private Attributes | |
double | _s |
An accumulator for sums.
This allow many double precision numbers to be added together with twice the normal precision. Thus the effective precision of the sum is 106 bits or about 32 decimal places.
The implementation follows J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) 305–363 (1997).
In the documentation of the member functions, sum stands for the value currently held in the accumulator.
Definition at line 25 of file Accumulator.java.
|
inline |
|
inline |
Construct from another Accumulator.
a | set sum = a. |
Definition at line 39 of file Accumulator.java.
|
inline |
Add a number to the accumulator.
y | set sum += y. |
Definition at line 69 of file Accumulator.java.
|
inline |
|
inline |
|
inline |
Return the value held in the accumulator.
Definition at line 51 of file Accumulator.java.
|
inline |
Return the result of adding a number to sum (but don't change sum).
y | the number to be added to the sum. |
Definition at line 59 of file Accumulator.java.
|
private |
Definition at line 27 of file Accumulator.java.