Skip to content

Commit

Permalink
Merge pull request #27 from fkastner/master
Browse files Browse the repository at this point in the history
fix some errors reported by JET.jl
  • Loading branch information
fkastner authored Dec 5, 2023
2 parents b5fb346 + 9756c82 commit c7e0f89
Show file tree
Hide file tree
Showing 3 changed files with 4 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.9"
version = "0.1.10"

[deps]
Nemo = "2edaba10-b0f1-5616-af89-8c11ac63239a"
Expand Down
4 changes: 2 additions & 2 deletions src/algebraic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ end
function ==(an1::AlgebraicNumber,an2::AlgebraicNumber)
cf1 = an1.coeff
cf2 = an2.coeff
(cf1/cf1[end])==(cf2/cf2[end]) || return false
(cf1./cf1[end])==(cf2./cf2[end]) || return false
prec1 = calc_precision(an1.coeff, an1.apprx)
prec2 = calc_precision(an2.coeff, an2.apprx)
return abs(an1.apprx-an2.apprx)<min(prec1,prec2)
Expand Down Expand Up @@ -185,7 +185,7 @@ end

# partially simplify a polynomial b
# eliminating repeated factors
reduce_repeated_factors(p::Nemo.ZZPolyRingElem) = prod(keys(Nemo.factor(p)))
reduce_repeated_factors(p::Nemo.ZZPolyRingElem) = prod([p for (p,e) in Nemo.factor(p)]; init=one(p))

# multiplication
function *(an1::AlgebraicNumber,an2::AlgebraicNumber)
Expand Down
2 changes: 1 addition & 1 deletion src/promote.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ function convert(::Type{Int64},an::AlgebraicNumber)
if length(c)==2 && abs(c[2])==1
return convert(Int64, -c[1]*c[2])
else
throw(InexactError())
throw(InexactError(:convert, Int64, an))
end
end

0 comments on commit c7e0f89

Please sign in to comment.