diff --git a/src/Eta.jl b/src/Eta.jl index 30a71d6..f7979f9 100644 --- a/src/Eta.jl +++ b/src/Eta.jl @@ -65,7 +65,7 @@ function neg_eta(n::Integer, T=Float64) if T == Float64 neg_eta_f46(n) else - (exp2(1 - n) - one(T))*zeta(n, T) + neg_eta_big(n) end end @@ -88,3 +88,7 @@ function neg_eta_f46(n::Integer)::Float64 -1.0 end end + +function neg_eta_big(n::Integer)::BigFloat + (exp2(1 - n) - one(T))*zeta(n, T) +end diff --git a/src/Zeta.jl b/src/Zeta.jl index d981162..6b81a15 100644 --- a/src/Zeta.jl +++ b/src/Zeta.jl @@ -92,19 +92,8 @@ function zeta_f64(n::Integer)::Float64 end function zeta_big(n::Integer)::BigFloat - if n < 0 - throw(DomainError(n, "zeta(n, T=$(T)) not implemented for n < 0")) - elseif n == 0 - BigFloat("-0.5") - elseif n == 1 - BigFloat("Inf") - else - sum = one(T) - for i in 2:typemax(n) - old_sum = sum - sum += (-1)^(i+1)*convert(T, i)^(-n) - sum == old_sum && break - end - sum/(one(T) - exp2(1 - n)) - end + x = BigFloat(n) + z = BigFloat() + ccall((:mpfr_zeta, :libmpfr), Int32, (Ref{BigFloat}, Ref{BigFloat}, Int32), z, x, ROUNDING_MODE[]) + return z end