![]() |
MySQL 9.6.0
Source Code Documentation
|
Tracks the state of the Kahan summation algorithm, which produces a sum over a sequence of floating point numbers with very low numeric error, using an internal error compensation term. More...
#include <summation.h>
Public Types | |
| using | Value_t = Value_tp |
Public Member Functions | |
| Kahan_sum (Value_t value=0) | |
| operator Value_t () const | |
| Return the current approximated sum. More... | |
| Kahan_sum & | operator+= (const Value_t &value) |
| In-place add the given value to this object. More... | |
| Kahan_sum & | operator-= (const Value_t &value) |
| In-place subtract the given value from this object. More... | |
| Kahan_sum | operator+ (const Value_t &value) const |
| Return a new object holding the sum of this object and the given value. More... | |
| Kahan_sum | operator- (const Value_t &value) const |
| Return a new object holding this object minus the given value. More... | |
Private Attributes | |
| Value_t | m_sum |
| Value_t | m_compensation {0} |
Tracks the state of the Kahan summation algorithm, which produces a sum over a sequence of floating point numbers with very low numeric error, using an internal error compensation term.
| Value_tp | The numeric type used in internal computations, and to store the result. |
| using mysql::math::Kahan_sum< Value_tp >::Value_t = Value_tp |
|
inlineexplicit |
|
inlineexplicit |
Return the current approximated sum.
|
inline |
Return a new object holding the sum of this object and the given value.
|
inline |
In-place add the given value to this object.
|
inline |
Return a new object holding this object minus the given value.
|
inline |
In-place subtract the given value from this object.
|
private |
|
private |