Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some errors reported by JET.jl #27

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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