Skip to content

Commit

Permalink
Merge pull request #26 from fkastner/master
Browse files Browse the repository at this point in the history
fix type instability
  • Loading branch information
fkastner authored Dec 4, 2023
2 parents b30b1aa + 3639bd8 commit b5fb346
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 b5fb346

Please sign in to comment.