Repository: mpmath/mpmath (python)

Issue:
zeta(2, -2) crashes.
```
>>> from mpmath import *
>>> mp.dps = 100
>>> zeta(2, -2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/functions/zeta.py", line 580, in zeta
    return +ctx._hurwitz(s, a, d, **kwargs)
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/functions/zeta.py", line 604, in _hurwitz
    T1, T2 = _hurwitz_em(ctx, s, a, d, prec+10, verbose)
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/functions/zeta.py", line 675, in _hurwitz_em
    l = ctx._zetasum(s, M1+a, M2-M1-1, [d])[0][0]
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/functions/zeta.py", line 749, in _zetasum
    return [ctx.fsum((a+k)**negs for k in xrange(n+1))], []
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/ctx_mp_python.py", line 849, in fsum
    for term in terms:
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/functions/zeta.py", line 749, in <genexpr>
    return [ctx.fsum((a+k)**negs for k in xrange(n+1))], []
  File "<string>", line 9, in __pow__
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/libmp/libelefun.py", line 328, in mpf_pow
    return mpf_pow_int(s, (-1)**tsign * (tman<<texp), prec, rnd)
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/libmp/libmpf.py", line 1073, in mpf_pow_int
    return mpf_div(fone, inverse, prec, rnd)
  File "/home/palaiologos/.local/lib/python3.10/site-packages/mpmath/libmp/libmpf.py", line 960, in mpf_div
    raise ZeroDivisionError
ZeroDivisionError
```

However, WolframAlpha claims that it is simply complex infinity:

https://www.wolframalpha.com/input?i=hurwitz%282%2C-2%29


Pull request:
Misc fixes
* raise ValueError for complex infininity condition in zeta(s, a), closes #653
* remove remnants of fnzero

Patch:
diff --git a/README.rst b/README.rst
index b7e5d82..6e3fa82 100644
--- a/README.rst
+++ b/README.rst
@@ -171,8 +171,8 @@ Mpmath is a work in progress. Major issues include:
   or two units in the last place (even if otherwise accurate).
 
 * Some IEEE 754 features are not available. Inifinities and NaN are
-  partially supported; denormal rounding is currently not available
-  at all.
+  partially supported, there is no signed zero; denormal rounding is
+  not available at all.
 
 * The interface for switching precision and rounding is not finalized.
   The current method is not threadsafe.
diff --git a/mpmath/functions/zeta.py b/mpmath/functions/zeta.py
index eb09a1b..3e3b542 100644
--- a/mpmath/functions/zeta.py
+++ b/mpmath/functions/zeta.py
@@ -588,6 +588,10 @@ def _hurwitz(ctx, s, a=1, d=0, **kwargs):
         ctx.prec += extraprec
         # We strongly want to special-case rational a
         a, atype = ctx._convert_param(a)
+
+        if ctx.re(a) < 0 and ctx.isnpint(a):
+            raise ValueError("Hurwitz zeta complex infinity")
+
         if ctx.re(s) < 0:
             if verbose:
                 print("zeta: Attempting reflection formula")
diff --git a/mpmath/libmp/__init__.py b/mpmath/libmp/__init__.py
index 5c46416..7dbc19e 100644
--- a/mpmath/libmp/__init__.py
+++ b/mpmath/libmp/__init__.py
@@ -43,7 +43,7 @@
                      mpc_tanh, mpc_to_complex, mpc_to_str, mpc_two, mpc_zero,
                      mpf_expj, mpf_expjpi)
 from .libmpf import (ComplexResult, dps_to_prec, fhalf, finf, fnan, fninf,
-                     fnone, fnzero, fone, format_mpc, format_mpf, from_Decimal,
+                     fnone, fone, format_mpc, format_mpf, from_Decimal,
                      from_float, from_int, from_man_exp, from_npfloat,
                      from_pickable, from_rational, from_str, ften, ftwo, fzero,
                      mpf_abs, mpf_add, mpf_ceil, mpf_cmp, mpf_div, mpf_eq,
diff --git a/mpmath/libmp/libmpc.py b/mpmath/libmp/libmpc.py
index 2624665..c5b8cd3 100644
--- a/mpmath/libmp/libmpc.py
+++ b/mpmath/libmp/libmpc.py
@@ -12,13 +12,13 @@
                         mpf_pow_int, mpf_sin, mpf_sin_pi, mpf_sinh, mpf_tan,
                         mpf_tanh)
 from .libintmath import giant_steps, lshift, rshift
-from .libmpf import (ComplexResult, fhalf, finf, fnan, fninf, fnone, fnzero,
-                     fone, from_float, from_int, from_man_exp, ftwo, fzero,
-                     mpf_abs, mpf_add, mpf_ceil, mpf_div, mpf_floor, mpf_frac,
-                     mpf_hash, mpf_hypot, mpf_mul, mpf_mul_int, mpf_neg,
-                     mpf_nint, mpf_pos, mpf_rdiv_int, mpf_shift, mpf_sqrt,
-                     mpf_sub, normalize, reciprocal_rnd, round_fast,
-                     round_floor, to_fixed, to_float, to_int, to_str)
+from .libmpf import (ComplexResult, fhalf, finf, fnan, fninf, fnone, fone,
+                     from_float, from_int, from_man_exp, ftwo, fzero, mpf_abs,
+                     mpf_add, mpf_ceil, mpf_div, mpf_floor, mpf_frac, mpf_hash,
+                     mpf_hypot, mpf_mul, mpf_mul_int, mpf_neg, mpf_nint,
+                     mpf_pos, mpf_rdiv_int, mpf_shift, mpf_sqrt, mpf_sub,
+                     normalize, reciprocal_rnd, round_fast, round_floor,
+                     to_fixed, to_float, to_int, to_str)
 
 
 # An mpc value is a (real, imag) tuple
@@ -474,7 +474,7 @@ def mpc_tan(z, prec, rnd=round_fast):
     if b == fninf:
         return fzero, fnone
     if a in (finf, fninf):
-        if b in (fzero, fnzero):
+        if b == fzero:
             return fnan, fzero
         return fnan, fnan
     asign, aman, aexp, abc = a
diff --git a/mpmath/libmp/libmpf.py b/mpmath/libmp/libmpf.py
index 2e09ccb..dba0b08 100644
--- a/mpmath/libmp/libmpf.py
+++ b/mpmath/libmp/libmpf.py
@@ -62,7 +62,6 @@ def repr_dps(n):
 # Regular number format:
 # (-1)**sign * mantissa * 2**exponent, plus mantissa.bit_length()
 fzero = (0, MPZ_ZERO, 0, 0)
-fnzero = (1, MPZ_ZERO, 0, 0)
 fone = (0, MPZ_ONE, 0, 1)
 fnone = (1, MPZ_ONE, 0, 1)
 ftwo = (0, MPZ_ONE, 1, 1)


Test patch:
diff --git a/mpmath/tests/test_functions2.py b/mpmath/tests/test_functions2.py
index cd74e8b..d971e24 100644
--- a/mpmath/tests/test_functions2.py
+++ b/mpmath/tests/test_functions2.py
@@ -2403,3 +2403,6 @@ def test_issue_505():
     assert mp.isnan(mp.polylog(mp.inf, 2.2))
     assert mp.isnan(mp.polylog(mp.ninf, 2.2))
     assert mp.isnan(mp.polylog(mp.nan, 2.2))
+
+def test_issue_653():
+    pytest.raises(ValueError, lambda: zeta(2, -2))