Skip to content

Commit

Permalink
Fix is_rational (thofma#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma authored Jul 8, 2023
1 parent 6d5e988 commit c7ab8cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Hecke"
uuid = "3e1990a7-5d81-5526-99ce-9ba3ff248f21"
version = "0.19.4"
version = "0.19.5"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
2 changes: 1 addition & 1 deletion src/NumField/NfRel/NfRel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ function is_rational(a::NfRelElem)
return false
end
end
return true
return is_rational(coeff(a, 0))
end

################################################################################
Expand Down
7 changes: 7 additions & 0 deletions test/NfRel/NfRel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,12 @@
@test is_rational(2*b^0)
@test is_rational(2*o^0)
@test !is_rational(o)

Qx, x = QQ["x"]
K, r = number_field(x^3 - 3x^2 - 4x + 8, "r")
Ky, y = K["y"]
L, = number_field(y^2 - (2-r^2)//2, "q")
@test !(@inferred is_rational(L(r)))
@test_throws ErrorException QQ(L(r))
end
end

0 comments on commit c7ab8cd

Please sign in to comment.