Skip to content

Commit

Permalink
fix type instability
Browse files Browse the repository at this point in the history
  • Loading branch information
fkastner committed Dec 4, 2023
1 parent b30b1aa commit 3639bd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 2 additions & 3 deletions src/algebraic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3639bd8

Please sign in to comment.