JSDoc: Class: Accumulator (original) (raw)
geodesic/Accumulator.Accumulator(yopt)
This allows many numbers to be added together with twice the normal precision. In the documentation of the member functions, sum stands for the value currently held in the accumulator.
Constructor
new Accumulator(yopt)
Accurate summation of many numbers.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
y | number|Accumulator | 0 | set sum = y. |
Source:
Methods
Add(yopt)
Add a number to the accumulator.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
y | number | 0 | set sum += y. |
Source:
Negate()
Set sum = −sum.
Source:
Remainder(y)
Take the remainder
Parameters:
Name | Type | Description |
---|---|---|
y | number | the divisor of the remainder operation. |
Source:
Returns:
sum in range [−y/2, y/2].
Set(yopt)
Set the accumulator to a number.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
y | number|Accumulator | 0 | set sum = y. |
Source:
Sum(yopt)
Return the result of adding a number to sum (but don't change sum).
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
y | number | 0 | the number to be added to the sum. |
Source:
Returns:
sum + y.