## "Fossies" - the Fresh Open Source Software Archive

### Source code changes of the file "mpmath/libmp/libmpc.py" betweenmpmath-0.19.tar.gz and mpmath-1.0.0.tar.gz

About: mpmath is a Python library for arbitrary-precision floating-point arithmetic.

libmpc.py  (mpmath-0.19):libmpc.py  (mpmath-1.0.0)
skipping to change at line 63 skipping to change at line 63
return False return False
def mpc_to_str(z, dps, **kwargs): def mpc_to_str(z, dps, **kwargs):
re, im = z re, im = z
rs = to_str(re, dps) rs = to_str(re, dps)
if im[0]: if im[0]:
return rs + " - " + to_str(mpf_neg(im), dps, **kwargs) + "j" return rs + " - " + to_str(mpf_neg(im), dps, **kwargs) + "j"
else: else:
return rs + " + " + to_str(im, dps, **kwargs) + "j" return rs + " + " + to_str(im, dps, **kwargs) + "j"
def mpc_to_complex(z, strict=False): def mpc_to_complex(z, strict=False, rnd=round_fast):
re, im = z re, im = z
return complex(to_float(re, strict)) return complex(to_float(re, strict, rnd), to_float(im, strict, rnd))
def mpc_hash(z): def mpc_hash(z):
if sys.version >= "3.2": if sys.version >= "3.2":
re, im = z re, im = z
h = mpf_hash(re) + sys.hash_info.imag * mpf_hash(im) h = mpf_hash(re) + sys.hash_info.imag * mpf_hash(im)
# Need to reduce either module 2^32 or 2^64 # Need to reduce either module 2^32 or 2^64
h = h % (2**sys.hash_info.width) h = h % (2**sys.hash_info.width)
return int(h) return int(h)
else: else:
try: try:
End of changes. 2 change blocks.
2 lines changed or deleted 2 lines changed or added