Class: Accumulator

GeographicLib/Accumulator. Accumulator

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 <optional>
0

set sum = y.

Source:

Methods

Add(yopt)

Add a number to the accumulator.

Parameters:
Name Type Attributes Default Description
y number <optional>
0

set sum += y.

Source:

Negate()

Set sum = −sum.

Source:

Set(yopt)

Set the accumulator to a number.

Parameters:
Name Type Attributes Default Description
y number | Accumulator <optional>
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 <optional>
0

the number to be added to the sum.

Source:
Returns:

sum + y.