Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# sympy.mpmath.libmp.backend.MPZ

All Samples(20)  |  Call(18)  |  Derive(0)  |  Import(2)
```long(x=0) -> long
long(x, base=10) -> long

Convert a number or string to a long integer, or return 0L if no arguments
are given.  If x is floating point, the conversion truncates towards zero.

If x is not a number or if base is given, then x must be a string or
Unicode object representing an integer literal in the given base.  The
literal can be preceded by '+' or '-' and be surrounded by whitespace.
The base defaults to 10.  Valid bases are 0 and 2-36.  Base 0 means to(more...)
```

```from sympy.mpmath.libmp import (mpf_pi, mpf_log, mpf_pow, mpf_sin, mpf_cos,
mpf_atan, mpf_atan2, mpf_e, mpf_exp, from_man_exp, from_int)
from sympy.mpmath.libmp.backend import MPZ
from sympy.mpmath import nsum
from sympy.mpmath import inf as mpmath_inf
```
```    direction = 0
# Empty product is 1
man, exp, bc = MPZ(1), 0, 1
direction = 0
complex_factors = []
```
```        # make existing real scalar look like an imaginary and
# multiply by the remaining complex numbers
re, im = v, (0, MPZ(0), 0, 0)
for wre, wim, wre_acc, wim_acc in complex_factors:
# acc is the overall accuracy of the product; we aren't
```
```    # Direct summation if geometric or faster
if h > 0 or (h == 0 and abs(g) > 1):
one = MPZ(1) << prec
term = expr.subs(n, 0)
term = (MPZ(term.p) << prec) // term.q
```

```        mpf_sqrt, normalize, round_nearest, to_int, to_str)
from sympy.mpmath.libmp import bitcount as mpmath_bitcount
from sympy.mpmath.libmp.backend import MPZ
from sympy.mpmath.libmp.libmpc import _infs_nan
from sympy.mpmath.libmp.libmpf import dps_to_prec
```
```
# Empty product is 1
start = man, exp, bc = MPZ(1), 0, 1

# First, we multiply all pure real or pure imaginary numbers.
```
```        if (man, exp, bc) != start:
# there was a real part; give it an imaginary part
re, im = (sign, man, exp, bitcount(man)), (0, MPZ(0), 0, 0)
i0 = 0
else:
```
```    if h > 0 or (h == 0 and abs(g) > 1):
term = expr.subs(n, 0)
term = (MPZ(term.p) << prec) // term.q
s = term
k = 1
while abs(term) > 5:
term *= MPZ(func1(k - 1))
```