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

# Class Fsum

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

Known Subclasses:
  - fmath.Fn_rt
  - , fmath.Fdot
  - , fmath.Fhorner
  - , fmath.Fhypot
  - , fmath.Fpolynomial
  - , fmath.Fpowers
  - , elliptic._Deferred_Fsum

Precision floating point running summation.

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

Notes:

- Accumulated values may be Fsum or `scalar` instances with `scalar` meaning type `float`, `int` or any `type` convertible to a single `float`, having method `__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 precision floating point running summation. |
__abs__(self) Return this instance' absolute value as an Fsum. |
__add__(self, other) Return the `Fsum(self, other)`. |
__bool__(self) Return `True` if this instance is 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 2-tuple `(quotient, remainder)`, an `int` in Python 3+ or `float` in Python 2- and 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) 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) Apply `self /= other` to this instance. |
__le__(self, other) Compare this with an other instance or scalar. |
__len__(self) Return the total number accumulations (`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=None) Not implemented. |
__rpow__(self, other, *mod) Return `other**self` as an Fsum. |
__rsub__(self, other) Return `other - self` as Fsum. |
__rtruediv__(self, other) Return `other / self` as an Fsum. |
int |
__sizeof__(self) Return the current size of this instance in `bytes`. |
__str__(self) Return the default `str(self)`. |
__sub__(self, other) Return `self - other` as an Fsum. |
__truediv__(self, other) Return `self / other` as an Fsum. |
__trunc__(self) Return this instance as an `int`. |
__div__(self, other) Return `self / other` as an Fsum. |
__idiv__(self, other) Apply `self /= other` to this instance. |
__long__(self) Return this instance as an `int`. |
__nonzero__(self) Return `True` if this instance is non-zero. |
__rdiv__(self, other) 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) 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) Apply `self /= other` to this instance. |
fdivmod(self, other) Return `divmod(self, other)` as 2-tuple `(quotient, remainder)`, an `int` in Python 3+ or `float` in Python 2- and 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) Apply `self /= over` and summate. |
fpow(self, other, *mod) Apply `self **= other` to this instance. |
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. |
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`. |
int_float(self, raiser=False) Return this instance' current running sum as `int` or `float`. |
is_exact(self) Is this instance' current running `fsum` considered to be exact? (`bool`). |
is_integer(self) Is this instance' current 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) 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`. |
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__`, `__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 and/or `int`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` Inherited from `object`: `__class__`

Method Details

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

### __add__ (self, other) (Addition operator) |
Return the `Fsum(self, other)`. 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 2-tuple `(quotient, remainder)`, an `int` in Python 3+ or `float` in Python 2- and 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) |
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. 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) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. 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__.

### __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) |
Return `other / self` as an Fsum. See Also: Method Fsum.__itruediv__.

### __sizeof__ (self) |
Return the current size of this instance in `bytes`. Returns: int Overrides: object.__sizeof__

### __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) |
Return `self / other` as an Fsum. Arguments: `other` - An Fsum or `scalar` divisor. 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) |
Return `self / other` as an Fsum. Arguments: `other` - An Fsum or `scalar` divisor. Returns: The quotient (Fsum). See Also: Method Fsum.__itruediv__.

### __idiv__ (self, other) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. 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) |
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) |
Return `divmod(self, other)` as 2-tuple `(quotient, remainder)`. Arguments: `other` - An Fsum or `scalar` divisor. Returns: 2-Tuple `(quotient, remainder)`, with the `quotient` an `int` in Python 3+ or a `float` in Python 2- and the `remainder` 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) |
Apply `self /= other` to this instance. Arguments: `other` - An Fsum or `scalar` divisor. 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 2-tuple `(quotient, remainder)`, an `int` in Python 3+ or `float` in Python 2- and 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` - If `True` throw a ResidualError if the integer residual is non-zero. `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) |
Apply `self /= over` and summate. Arguments: `over` - An Fsum or `scalar` denominator. Returns: Precision running sum (`float`). See Also: Methods Fsum.fsum and Fsum.__itruediv__.

### fpow (self, other, *mod) |
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. 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.

### 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: Method Fsum.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: 2-Tuple `(fsum, delta)` with the current precision running `fsum` and `delta`, the difference with the previous running `fsum` (`float`s). 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. 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' current 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) |
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. 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 `integer` with Fsum.fint. See Also: Methods Fsum.__ipow__, Fsum.fint and Fsum.is_integer.

### 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`). Raises: `ValueError` - Negative `threshold`. Note: A ResidualError is thrown if the non-zero ratio `residual` / `fsum` exceeds the `threshold`.

### 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 and/or `int`s). Get method: partials(self) - Get this instance' current partial sums (`tuple` of `float`s and/or `int`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.