diff --git a/src/funcs.f90 b/src/funcs.f90 index 8897c88..bea2ab3 100644 --- a/src/funcs.f90 +++ b/src/funcs.f90 @@ -446,7 +446,7 @@ elemental real(wp) FUNCTION RIEMANNZETA (S,EPS) NSTERM = S*(S+1)*(S+2)* & (S+3)*(S+4)/30240 -N = int((NSTERM*(2**S)/EPS)**(1._wp/(S+5))) +N = int((NSTERM*(2**S)/EPS)**(1 / (S+5))) IF ( N < 10 ) THEN N = 10 END IF @@ -461,7 +461,7 @@ elemental real(wp) FUNCTION RIEMANNZETA (S,EPS) ! Add Euler-Maclaurin correction terms SUM = SUM+(FN**NEGS)*(0.5D00+FN/(S-1) & - +S*(1._wp-(S+ 1._wp)*(S+2)/ & + +S*(1 - (S + 1)*(S+2)/ & (60*FN*FN)) & /(12*FN))+NSTERM/(FN**(S+5)) riemannZETA = SUM diff --git a/tests/test_functions.py b/tests/test_functions.py index 71ec71f..e87f5ce 100644 --- a/tests/test_functions.py +++ b/tests/test_functions.py @@ -22,8 +22,9 @@ def frun(name: str, args) -> float: if not isinstance(args, (list, tuple)): args = [args] input = "\n".join(map(str, args)) + "\n" + name - raw = subprocess.check_output([EXE], input=input, text=True, timeout=5) - return float(raw.strip().split("\n")[-1]) + raw = subprocess.run([EXE], capture_output=True, input=input, text=True, timeout=5) + assert not raw.stderr, raw.stderr + return float(raw.stdout.strip().split("\n")[-1]) def test_bessel0(): @@ -56,5 +57,10 @@ def test_bessel_general(): assert frun(k, a) == approx(f(*a)) +def test_riemann_zeta(): + + assert frun("rzeta", (2)) == approx(sp.zeta(2)) + + if __name__ == "__main__": pytest.main([__file__])