From 3639bd8e89430482fc435ae1ec491fa276acc6bf Mon Sep 17 00:00:00 2001 From: Felix Kastner Date: Mon, 4 Dec 2023 10:21:13 +0100 Subject: [PATCH] fix type instability --- Project.toml | 2 +- src/algebraic.jl | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 70166b5..31a55ad 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AlgebraicNumbers" uuid = "e86d093a-a386-599e-b7c7-df0420c8bcba" authors = ["Al Nejati", "Felix Kastner"] -version = "0.1.8" +version = "0.1.9" [deps] Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a" diff --git a/src/algebraic.jl b/src/algebraic.jl index 4a15fe6..aa6fbd6 100644 --- a/src/algebraic.jl +++ b/src/algebraic.jl @@ -78,7 +78,7 @@ function calc_precision(coeff::Vector{T}, apprx::Complex{F}) where {T<:Integer,F biginf = convert(F,Inf) n = length(x) if n<=1 - return Inf + return biginf else pdists = [i < j ? abs(x[i]-x[j]) : biginf for i=1:n,j=1:n] return minimum(pdists) @@ -131,8 +131,7 @@ function simplify(an::AlgebraicNumber) mindists = [minimum(abs.(an.apprx .- prec_roots(get_coeffs(fctr)))) for fctr in fctrs] (newprec, i) = findmin(mindists) fctr = collect(fctrs)[i] - an = AlgebraicNumber(get_coeffs(fctr),an.apprx,newprec) - return an + return AlgebraicNumber(get_coeffs(fctr),an.apprx,newprec) end function ==(an1::AlgebraicNumber,an2::AlgebraicNumber)