Package pygeodesy :: Module fsums :: Class Fsum |
[frames] | no frames]

# Class Fsum

      object --+
               |
    named._Named --+
                   |
                  Fsum

Known Subclasses:
  - fmath.Froot
  - , fmath.Fdot
  - , fmath.Fhorner
  - , fmath.Fhypot
  - , fmath.Fpolynomial
  - , fmath.Fpowers

Precision floating point summation and running summation.

Unlike Python's `math.fsum`, this class accumulates values and provides intermediate, running, precision floating point summations. Accumulation may continue after any intermediate, running summuation.

Notes:

- Accumulated values may be Fsum or `scalar` instances, any `type` having method `__float__` to convert the `scalar` to a single `float`.
- Handling of exceptions and `inf`, `INF`, `nan` and `NAN` differs from Python's `math.fsum`.

See Also: Hettinger, Kahan, Klein, Python 2.6+ file Modules/mathmodule.c and the issue log Full precision summation.

Instance Methods
__init__(self, *xs, **name_RESIDUAL) New Fsum for running precision floating point summation. |
__abs__(self) Return this instance' absolute value as an Fsum. |
__add__(self, other) Return `self + other` as an Fsum. |
__bool__(self) Return `True` if this instance is exactly non-zero. |
__ceil__(self) Return this instance' `math.ceil` as `int` or `float`. |
__cmp__(self, other) Compare this with an other instance or `scalar`. |
cmp(self, other) Compare this with an other instance or `scalar`. |
__divmod__(self, other) Return `divmod(self, other)` as a DivMod2Tuple with quotient `div` an `int` in Python 3+ or `float` in Python 2- and remainder `mod` an Fsum. |
__eq__(self, other) Compare this with an other instance or `scalar`. |
__float__(self) Return this instance' current, precision running sum as `float`. |
__floor__(self) Return this instance' `math.floor` as `int` or `float`. |
__floordiv__(self, other) Return `self // other` as an Fsum. |
__format__(self, *other) Not implemented. |
__ge__(self, other) Compare this with an other instance or `scalar`. |
__gt__(self, other) Compare this with an other instance or `scalar`. |
__hash__(self) Return this instance' `hash`. |
__iadd__(self, other) Apply `self += other` to this instance. |
__ifloordiv__(self, other) Apply `self //= other` to this instance. |
__imatmul__(self, other) Not implemented. |
__imod__(self, other) Apply `self %= other` to this instance. |
__imul__(self, other) Apply `self *= other` to this instance. |
__int__(self) Return this instance as an `int`. |
__invert__(self) Not implemented. |
__ipow__(self, other, *mod, **raiser) Apply `self **= other` to this instance. |
__isub__(self, other) Apply `self -= other` to this instance. |
__iter__(self) Return an `iter`ator over a `partials` duplicate. |
__itruediv__(self, other, **raiser) Apply `self /= other` to this instance. |
__le__(self, other) Compare this with an other instance or `scalar`. |
__len__(self) Return the number of values accumulated (`int`). |
__lt__(self, other) Compare this with an other instance or `scalar`. |
__matmul__(self, other) Not implemented. |
__mod__(self, other) Return `self % other` as an Fsum. |
__mul__(self, other) Return `self * other` as an Fsum. |
__ne__(self, other) Compare this with an other instance or `scalar`. |
__neg__(self) Return a copy of this instance, negated. |
__pos__(self) Return this instance as-is, like `float.__pos__()`. |
__pow__(self, other, *mod) Return `self**other` as an Fsum. |
__radd__(self, other) Return `other + self` as an Fsum. |
__rdivmod__(self, other) Return `divmod(other, self)` as 2-tuple `(quotient, remainder)`. |
__rfloordiv__(self, other) Return `other // self` as an Fsum. |
__rmatmul__(self, other) Not implemented. |
__rmod__(self, other) Return `other % self` as an Fsum. |
__rmul__(self, other) Return `other * self` as an Fsum. |
__round__(self, *ndigits) Return `round(self, *ndigits` as an Fsum. |
__rpow__(self, other, *mod) Return `other**self` as an Fsum. |
__rsub__(self, other) Return `other - self` as Fsum. |
__rtruediv__(self, other, **raiser) Return `other / self` as an Fsum. |
__str__(self) Return the default `str(self)`. |
__sub__(self, other) Return `self - other` as an Fsum. |
__truediv__(self, other, **raiser) Return `self / other` as an Fsum. |
__trunc__(self) Return this instance as an `int`. |
__div__(self, other, **raiser) Return `self / other` as an Fsum. |
__idiv__(self, other, **raiser) Apply `self /= other` to this instance. |
__long__(self) Return this instance as an `int`. |
__nonzero__(self) Return `True` if this instance is exactly non-zero. |
__rdiv__(self, other, **raiser) Return `other / self` as an Fsum. |
as_integer_ratio(self) Return this instance as the ratio of 2 integers. |
copy(self, deep=False, name='') Copy this instance, `shallow` or `deep`. |
divmod(self, other, **raiser) Return `divmod(self, other)` as 2-tuple `(quotient, remainder)`. |
fadd(self, xs=`(``)`) Add an iterable of `scalar` or Fsum instances to this instance. |
fadd_(self, *xs) Add all positional `scalar` or Fsum instances to this instance. |
fcopy(self, deep=False, name='') Copy this instance, `shallow` or `deep`. |
fdiv(self, other, **raiser) Apply `self /= other` to this instance. |
fdivmod(self, other) Return `divmod(self, other)` as a DivMod2Tuple with quotient `div` an `int` in Python 3+ or `float` in Python 2- and remainder `mod` an Fsum. |
fint(self, raiser=True, **name) Return this instance' current running sum as `integer`. |
fint2(self, **name) Return this instance' current running sum as `int` and the integer residual. |
fmul(self, other) Apply `self *= other` to this instance. |
fover(self, over, **raiser) Apply `self /= over` and summate. |
fpow(self, other, *mod, **raiser) Apply `self **= other` to this instance. |
fset_(self, *xs) Replace this instance' value with `xs`. |
fsub(self, xs=`(``)`) Subtract an iterable of `scalar` or Fsum instances from this instance. |
fsub_(self, *xs) Subtract all positional `scalar` or Fsum instances from this instance. |
fsum(self, xs=`(``)`) Add more `scalar` or Fsum instances and summate. |
fsum_(self, *xs) Add all positional `scalar` or Fsum instances and summate. |
Fsum_(self, *xs) Like method Fsum.fsum_ but returning an Fsum. |
fsum2(self, xs=`(``)`, name='') Add more `scalar` or Fsum instances and return the current precision running sum and the `residual`. |
fsum2_(self, *xs) Add any positional `scalar` or Fsum instances and return the precision running sum and the `differential`. |
fsumf_(self, *xs) Like method Fsum.fsum_ but only for `xs`, known to be scalar. |
Fsumf_(self, *xs) Like method Fsum.Fsum_ but only for `xs`, known to be scalar. |
fsum2f_(self, *xs) Like method Fsum.fsum2_ but only for `xs`, known to be scalar. |
int_float(self, raiser=False) Return this instance' current running sum as `int` or `float`. |
is_exact(self) Is this instance' running `fsum` considered to be exact? (`bool`). |
is_integer(self) Is this instance' running sum `integer`? (`bool`). |
is_math_fsum(self) Return whether functions fsum, fsum_, fsum1 and fsum1_ plus partials summation are based on Python's `math.fsum` or not. |
pow(self, x, *mod, **raiser) Return `self**x` as Fsum. |
RESIDUAL(self, *threshold) Get and set this instance' ratio for raising ResidualErrors, overriding the default from env variable `PYGEODESY_FSUM_RESIDUAL`. |
root(self, root, **raiser) Return `self**(1 / root)` as Fsum. |
signOf(self, res=True) Determine the sign of this instance. |
toRepr(self, **prec_sep_fmt_lenc) Return this `Fsum` instance as representation. |
toStr(self, **prec_sep_fmt_lenc) Return this `Fsum` instance as string. |
Inherited from `named._Named`: `__repr__`, `attrs`, `classof`, `dup`, `methodname`, `rename`, `toStr2` Inherited from `object`: `__delattr__`, `__getattribute__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| ceil Get this instance' `ceil` value (`int` in Python 3+, but `float` in Python 2-).
| float_int DEPRECATED, use method `Fsum.int_float`.
| floor Get this instance' `floor` (`int` in Python 3+, but `float` in Python 2-).
| imag Get the `imaginary` part of this instance (`0.0`, always).
| partials Get this instance' current, partial sums (`tuple` of `float`s).
| real Get the `real` part of this instance (`float`).
| residual Get this instance' residual (`float` or `int`), the `sum(partials)` less the precision running sum `fsum`.
Inherited from `named._Named`: `classname`, `classnaming`, `iteration`, `name`, `named`, `named2`, `named3`, `named4`, `sizeof` Inherited from `object`: `__class__`

Method Details

### __init__ (self, *xs, **name_RESIDUAL) (Constructor) |
New Fsum for running precision floating point summation. Arguments: `xs` - No, one or more initial values, all positional (each `scalar` or an Fsum instance). `name_RESIDUAL` - Optional `name=NN` for this Fsum and `RESIDUAL=None` for the ResidualError threshold. Overrides: object.__init__ See Also: Methods Fsum.fadd and Fsum.RESIDUAL.

### __add__ (self, other) (Addition operator) |
Return `self + other` as an Fsum. Arguments: `other` - An Fsum or `scalar`. Returns: The sum (Fsum). See Also: Method Fsum.__iadd__.

### __ceil__ (self) |
Return this instance' `math.ceil` as `int` or `float`. Returns: An `int` in Python 3+, but `float` in Python 2-. See Also: Methods Fsum.__floor__ and property Fsum.ceil.

### __cmp__ (self, other) (Comparison operator) |
Compare this with an other instance or `scalar`. Returns: -1, 0 or +1 (`int`). Raises: `TypeError` - Incompatible `other` `type`.

### cmp (self, other) |
Compare this with an other instance or `scalar`. Returns: -1, 0 or +1 (`int`). Raises: `TypeError` - Incompatible `other` `type`.

### __divmod__ (self, other) |
Return `divmod(self, other)` as a DivMod2Tuple with quotient `div` an `int` in Python 3+ or `float` in Python 2- and remainder `mod` an Fsum. Arguments: `other` - An Fsum or `scalar` modulus. See Also: Method Fsum.__itruediv__.

### __float__ (self) |
Return this instance' current, precision running sum as `float`. See Also: Methods Fsum.fsum and Fsum.int_float.

### __floor__ (self) |
Return this instance' `math.floor` as `int` or `float`. Returns: An `int` in Python 3+, but `float` in Python 2-. See Also: Methods Fsum.__ceil__ and property Fsum.floor.

### __floordiv__ (self, other) |
Return `self // other` as an Fsum. Arguments: `other` - An Fsum or `scalar` divisor. Returns: The `floor` quotient (Fsum). See Also: Methods Fsum.__ifloordiv__.

### __format__ (self, *other) |
Not implemented. Overrides: object.__format__

### __hash__ (self) (Hashing function) |
Return this instance' `hash`. Overrides: object.__hash__

### __iadd__ (self, other) |
Apply `self += other` to this instance. Arguments: `other` - An Fsum or `scalar` instance. Returns: This instance, updated (Fsum). Raises: `TypeError` - Invalid `other`, not `scalar` nor Fsum. See Also: Methods Fsum.fadd and Fsum.fadd_.

### __ifloordiv__ (self, other) |
Apply `self //= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. Returns: This instance, updated (Fsum). Raises: `ResidualError` - Non-zero residual in `other`. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`. `ZeroDivisionError` - Zero `other`. See Also: Methods Fsum.__itruediv__.

### __imatmul__ (self, other) |
Not implemented. Overrides: named._Named.__imatmul__

### __imod__ (self, other) |
Apply `self %= other` to this instance. Arguments: `other` - An Fsum or `scalar` modulus. Returns: This instance, updated (Fsum). See Also: Method Fsum.__divmod__.

### __imul__ (self, other) |
Apply `self *= other` to this instance. Arguments: `other` - An Fsum or `scalar` factor. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`.

### __int__ (self) |
Return this instance as an `int`. See Also: Methods Fsum.int_float, Fsum.__ceil__ and Fsum.__floor__ and properties Fsum.ceil and Fsum.floor.

### __ipow__ (self, other, *mod, **raiser) |
Apply `self **= other` to this instance. Arguments: `other` - The exponent (Fsum or `scalar`). `mod` - Optional modulus (`int` or `None`) for the 3-argument `pow(self, other, mod)` version. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `ResidualError` - Non-zero residual in `other` and env var `PYGEODESY_FSUM_RESIDUAL` set or this instance has a non-zero residual and either `mod` is given and non-`None` or `other` is a negative or fractional `scalar`. `TypeError` - Invalid `other` type or 3-argument `pow` invocation failed. `ValueError` - If `other` is a negative `scalar` and this instance is `0` or `other` is a fractional `scalar` and this instance is negative or has a non-zero residual or `mod` is given and `0`. Note: If `mod` is given, the result will be an `integer` Fsum in Python 3+ if this instance `is_integer` or set to `as_integer` if `mod` given as `None`. See Also: CPython function float_pow.

### __isub__ (self, other) |
Apply `self -= other` to this instance. Arguments: `other` - An Fsum or `scalar`. Returns: This instance, updated (Fsum). Raises: `TypeError` - Invalid `other` type. See Also: Method Fsum.fadd.

### __itruediv__ (self, other, **raiser) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `ResidualError` - Non-zero residual in `other` and env var `PYGEODESY_FSUM_RESIDUAL` set. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`. `ZeroDivisionError` - Zero `other`. See Also: Method Fsum.__ifloordiv__.

### __matmul__ (self, other) |
Not implemented. Overrides: named._Named.__matmul__

### __mod__ (self, other) |
Return `self % other` as an Fsum. See Also: Method Fsum.__imod__.

### __mul__ (self, other) |
Return `self * other` as an Fsum. See Also: Method Fsum.__imul__.

### __pow__ (self, other, *mod) |
Return `self**other` as an Fsum. See Also: Method Fsum.__ipow__.

### __radd__ (self, other) (Right-side addition operator) |
Return `other + self` as an Fsum. See Also: Method Fsum.__iadd__.

### __rdivmod__ (self, other) |
Return `divmod(other, self)` as 2-tuple `(quotient, remainder)`. See Also: Method Fsum.__divmod__.

### __rfloordiv__ (self, other) |
Return `other // self` as an Fsum. See Also: Method Fsum.__ifloordiv__.

### __rmatmul__ (self, other) |
Not implemented. Overrides: named._Named.__rmatmul__

### __rmod__ (self, other) |
Return `other % self` as an Fsum. See Also: Method Fsum.__imod__.

### __rmul__ (self, other) |
Return `other * self` as an Fsum. See Also: Method Fsum.__imul__.

### __round__ (self, *ndigits) |
Return `round(self, *ndigits` as an Fsum. Arguments: `ndigits` - Optional number of digits (`int`).

### __rpow__ (self, other, *mod) |
Return `other**self` as an Fsum. See Also: Method Fsum.__ipow__.

### __rsub__ (self, other) |
Return `other - self` as Fsum. See Also: Method Fsum.__isub__.

### __rtruediv__ (self, other, **raiser) |
Return `other / self` as an Fsum. See Also: Method Fsum.__itruediv__.

### __str__ (self) (Informal representation operator) |
Return the default `str(self)`. Overrides: object.__str__

### __sub__ (self, other) (Subtraction operator) |
Return `self - other` as an Fsum. Arguments: `other` - An Fsum or `scalar`. Returns: The difference (Fsum). See Also: Method Fsum.__isub__.

### __truediv__ (self, other, **raiser) |
Return `self / other` as an Fsum. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: The quotient (Fsum). See Also: Method Fsum.__itruediv__.

### __trunc__ (self) |
Return this instance as an `int`. See Also: Methods Fsum.int_float, Fsum.__ceil__ and Fsum.__floor__ and properties Fsum.ceil and Fsum.floor.

### __div__ (self, other, **raiser) |
Return `self / other` as an Fsum. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: The quotient (Fsum). See Also: Method Fsum.__itruediv__.

### __idiv__ (self, other, **raiser) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `ResidualError` - Non-zero residual in `other` and env var `PYGEODESY_FSUM_RESIDUAL` set. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`. `ZeroDivisionError` - Zero `other`. See Also: Method Fsum.__ifloordiv__.

### __long__ (self) |
Return this instance as an `int`. See Also: Methods Fsum.int_float, Fsum.__ceil__ and Fsum.__floor__ and properties Fsum.ceil and Fsum.floor.

### __rdiv__ (self, other, **raiser) |
Return `other / self` as an Fsum. See Also: Method Fsum.__itruediv__.

### as_integer_ratio (self) |
Return this instance as the ratio of 2 integers. Returns: 2-Tuple `(numerator, denominator)` both `int` and with positive `denominator`. See Also: Standard `float.as_integer_ratio` in Python 3+.

### copy (self, deep=False, name='') |
Copy this instance, `shallow` or `deep`. Arguments: `deep` - If `True` make a deep, otherwise a shallow copy (`bool`). `name` - Optional, non-empty name (`str`). Returns: The copy (Fsum). Overrides: named._Named.copy

### divmod (self, other, **raiser) |
Return `divmod(self, other)` as 2-tuple `(quotient, remainder)`. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: A DivMod2Tuple`(div, mod)`, with quotient `div` an `int` in Python 3+ or `float` in Python 2- and remainder `mod` an Fsum instance. See Also: Method Fsum.__itruediv__.

### fadd (self, xs=`(``)`) |
Add an iterable of `scalar` or Fsum instances to this instance. Arguments: `xs` - Iterable, list, tuple, etc. (`scalar` or Fsum instances). Returns: This instance (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `TypeError` - An invalid `xs` type, not `scalar` nor Fsum. `ValueError` - Invalid or non-finite `xs` value.

### fadd_ (self, *xs) |
Add all positional `scalar` or Fsum instances to this instance. Arguments: `xs` - Values to add (`scalar` or Fsum instances), all positional. Returns: This instance (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `TypeError` - An invalid `xs` type, not `scalar` nor Fsum. `ValueError` - Invalid or non-finite `xs` value.

### fcopy (self, deep=False, name='') |
Copy this instance, `shallow` or `deep`. Arguments: `deep` - If `True` make a deep, otherwise a shallow copy (`bool`). `name` - Optional, non-empty name (`str`). Returns: The copy (Fsum).

### fdiv (self, other, **raiser) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `ResidualError` - Non-zero residual in `other` and env var `PYGEODESY_FSUM_RESIDUAL` set. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`. `ZeroDivisionError` - Zero `other`. See Also: Method Fsum.__ifloordiv__.

### fdivmod (self, other) |
Return `divmod(self, other)` as a DivMod2Tuple with quotient `div` an `int` in Python 3+ or `float` in Python 2- and remainder `mod` an Fsum. Arguments: `other` - An Fsum or `scalar` modulus. See Also: Method Fsum.__itruediv__.

### fint (self, raiser=True, **name) |
Return this instance' current running sum as `integer`. Arguments: `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. `name` - Optional name (`str`), overriding `"fint"`. Returns: The `integer` (Fsum). Raises: `ResidualError` - Non-zero integer residual. See Also: Methods Fsum.int_float and Fsum.is_integer.

### fint2 (self, **name) |
Return this instance' current running sum as `int` and the integer residual. Arguments: `name` - Optional name (`str`). Returns: An Fsum2Tuple`(fsum, residual)` with `fsum` an `int` and integer `residual` a `float` or `INT0` if the `fsum` is considered to be exact.

### fmul (self, other) |
Apply `self *= other` to this instance. Arguments: `other` - An Fsum or `scalar` factor. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `TypeError` - Invalid `other` type. `ValueError` - Invalid or non-finite `other`.

### fover (self, over, **raiser) |
Apply `self /= over` and summate. Arguments: `over` - An Fsum or `scalar` denominator. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: Precision running sum (`float`). See Also: Methods Fsum.fsum and Fsum.__itruediv__.

### fpow (self, other, *mod, **raiser) |
Apply `self **= other` to this instance. Arguments: `other` - The exponent (Fsum or `scalar`). `mod` - Optional modulus (`int` or `None`) for the 3-argument `pow(self, other, mod)` version. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: This instance, updated (Fsum). Raises: `OverflowError` - Partial `2sum` overflow. `ResidualError` - Non-zero residual in `other` and env var `PYGEODESY_FSUM_RESIDUAL` set or this instance has a non-zero residual and either `mod` is given and non-`None` or `other` is a negative or fractional `scalar`. `TypeError` - Invalid `other` type or 3-argument `pow` invocation failed. `ValueError` - If `other` is a negative `scalar` and this instance is `0` or `other` is a fractional `scalar` and this instance is negative or has a non-zero residual or `mod` is given and `0`. Note: If `mod` is given, the result will be an `integer` Fsum in Python 3+ if this instance `is_integer` or set to `as_integer` if `mod` given as `None`. See Also: CPython function float_pow.

### fset_ (self, *xs) |
Replace this instance' value with `xs`. Arguments: `xs` - Optional, new values (`scalar` or Fsum instances), all positional. Returns: This instance (`Fsum`). See Also: Method Fsum.fadd for further details.

### fsub (self, xs=`(``)`) |
Subtract an iterable of `scalar` or Fsum instances from this instance. Arguments: `xs` - Iterable, list, tuple. etc. (`scalar` or Fsum instances). Returns: This instance, updated (Fsum). See Also: Method Fsum.fadd.

### fsub_ (self, *xs) |
Subtract all positional `scalar` or Fsum instances from this instance. Arguments: `xs` - Values to subtract (`scalar` or Fsum instances), all positional. Returns: This instance, updated (Fsum). See Also: Method Fsum.fadd.

### fsum (self, xs=`(``)`) |
Add more `scalar` or Fsum instances and summate. Arguments: `xs` - Iterable, list, tuple, etc. (`scalar` or Fsum instances). Returns: Precision running sum (`float` or `int`). See Also: Method Fsum.fadd. Note: Accumulation can continue after summation.

### fsum_ (self, *xs) |
Add all positional `scalar` or Fsum instances and summate. Arguments: `xs` - Values to add (`scalar` or Fsum instances), all positional. Returns: Precision running sum (`float` or `int`). See Also: Methods Fsum.fsum, Fsum.Fsum_ and Fsum.fsumf_.

### Fsum_ (self, *xs) |
Like method Fsum.fsum_ but returning an Fsum. Returns: Current, precision running sum (Fsum).

### fsum2 (self, xs=`(``)`, name='') |
Add more `scalar` or Fsum instances and return the current precision running sum and the `residual`. Arguments: `xs` - Iterable, list, tuple, etc. (`scalar` or Fsum instances). `name` - Optional name (`str`). Returns: Fsum2Tuple`(fsum, residual)` with `fsum` the current precision running sum and `residual`, the (precision) sum of the remaining `partials`. The `residual is INT0` if the `fsum` is considered to be exact. See Also: Methods Fsum.fint2, Fsum.fsum and Fsum.fsum2_

### fsum2_ (self, *xs) |
Add any positional `scalar` or Fsum instances and return the precision running sum and the `differential`. Arguments: `xs` - Values to add (`scalar` or Fsum instances), all positional. Returns: 2Tuple `(fsum, delta)` with the current, precision running `fsum` like method Fsum.fsum and `delta`, the difference with previous running `fsum`, `float`. See Also: Methods Fsum.fsum_ and Fsum.fsum.

### int_float (self, raiser=False) |
Return this instance' current running sum as `int` or `float`. Arguments: `raiser` - If `True` throw a ResidualError if the residual is non-zero (`bool`). Returns: This `integer` sum if this instance `is_integer`, otherwise return the `float` sum if the residual is zero or if `raiser=False`. Raises: `ResidualError` - Non-zero residual and `raiser=True`. See Also: Methods Fsum.fint and Fsum.fint2.

### is_integer (self) |
Is this instance' running sum `integer`? (`bool`). See Also: Methods Fsum.fint and Fsum.fint2.

### is_math_fsum (self) |
Return whether functions fsum, fsum_, fsum1 and fsum1_ plus partials summation are based on Python's `math.fsum` or not. Returns: `2` if all functions and partials summation are based on `math.fsum`, `True` if only the functions are based on `math.fsum` (and partials summation is not) or `False` if none are.

### pow (self, x, *mod, **raiser) |
Return `self**x` as Fsum. Arguments: `x` - The exponent (Fsum or `scalar`). `mod` - Optional modulus (`int` or `None`) for the 3-argument `pow(self, other, mod)` version. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: The `pow(self, x)` or `pow(self, x, *mod)` result (Fsum). Note: If `mod` is given as `None`, the result will be an `integer` Fsum provided this instance `is_integer` or set to `integer` by an Fsum.fint call. See Also: Methods Fsum.__ipow__, Fsum.fint, Fsum.is_integer and Fsum.root.

### RESIDUAL (self, *threshold) |
Get and set this instance' ratio for raising ResidualErrors, overriding the default from env variable `PYGEODESY_FSUM_RESIDUAL`. Arguments: `threshold` - If `scalar`, the ratio to exceed for raising ResidualErrors in division and exponention, if `None` restore the default set with env variable `PYGEODESY_FSUM_RESIDUAL` or if omitted, keep the current setting. Returns: The previous `RESIDUAL` setting (`float`), default `0.`. Raises: `ValueError` - Negative `threshold`. Note: ResidualErrors will be thrown if the non-zero ratio `residual / fsum` exceeds the `threshold`.

### root (self, root, **raiser) |
Return `self**(1 / root)` as Fsum. Arguments: `root` - The order (`scalar` or `Fsum`), non-zero. `raiser` - Use `raiser=False` to ignore ResidualErrors (`bool`), see also method RESIDUAL. Returns: The `self ** (1 / root)` result (Fsum). See Also: Method Fsum.pow.

### signOf (self, res=True) |
Determine the sign of this instance. Arguments: `res` - If `True` consider, otherwise ignore the residual (`bool`). Returns: The sign (`int`, -1, 0 or +1).

### toRepr (self, **prec_sep_fmt_lenc) |
Return this `Fsum` instance as representation. Arguments: `prec_sep_fmt_lenc` - Optional keyword arguments for method Fsum2Tuple.toRepr plus `lenc=True` (`bool`) to in-/exclude the current `[len]` of this Fsum enclosed in [brackets]. Returns: This instance (`repr`). Overrides: named._Named.toRepr

### toStr (self, **prec_sep_fmt_lenc) |
Return this `Fsum` instance as string. Arguments: `prec_sep_fmt_lenc` - Optional keyword arguments for method Fsum2Tuple.toStr plus `lenc=True` (`bool`) to in-/exclude the current `[len]` of this Fsum enclosed in [brackets]. Returns: This instance (`str`). Overrides: named._Named.toStr

Property Details

### ceil Get this instance' `ceil` value (`int` in Python 3+, but `float` in Python 2-). Get method: ceil(self) - Get this instance' `ceil` value (`int` in Python 3+, but `float` in Python 2-). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. Note: The `ceil` takes the `residual` into account. See Also: Method Fsum.int_float and properties Fsum.floor, Fsum.imag and Fsum.real.

### float_int DEPRECATED, use method `Fsum.int_float`. Get method: float_int(self) - DEPRECATED, use method `Fsum.int_float`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### floor Get this instance' `floor` (`int` in Python 3+, but `float` in Python 2-). Get method: floor(self) - Get this instance' `floor` (`int` in Python 3+, but `float` in Python 2-). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. Note: The `floor` takes the `residual` into account. See Also: Method Fsum.int_float and properties Fsum.ceil, Fsum.imag and Fsum.real.

### imag Get the `imaginary` part of this instance (`0.0`, always). Get method: imag(self) - Get the `imaginary` part of this instance (`0.0`, always). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. See Also: Properties Fsum.ceil, Fsum.floor and Fsum.real.

### partials Get this instance' current, partial sums (`tuple` of `float`s). Get method: partials(self) - Get this instance' current, partial sums (`tuple` of `float`s). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value.

### real Get the `real` part of this instance (`float`). Get method: real(self) - Get the `real` part of this instance (`float`). Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. See Also: Methods Fsum.__float__ and Fsum.fsum and properties Fsum.ceil, Fsum.floor, Fsum.imag and Fsum.residual.

### residual Get this instance' residual (`float` or `int`), the `sum(partials)` less the precision running sum `fsum`. Get method: residual(self) - Get this instance' residual (`float` or `int`), the `sum(partials)` less the precision running sum `fsum`. Set method: _fset_error(inst, val) - Throws an `AttributeError`, always. Delete Method: _fdel(inst) - Zap the cached/memoized `property` value. Note: If the `residual is INT0`, the precision running `fsum` is considered to be exact. See Also: Methods Fsum.fsum, Fsum.fsum2 and Fsum.is_exact.