Skip to content
Open
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
5 changes: 5 additions & 0 deletions src/generic/GenericTypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,11 @@ mutable struct FunctionFieldElem{T <: FieldElement} <: AbstractAlgebra.FieldElem
parent::FunctionField{T}

function FunctionFieldElem{T}(R::FunctionField{T}, num::Poly{S}, den::S) where {T <: FieldElement, S <: PolyRingElem{T}}
if !iszero(num) #normalize the denominator
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only do this if the numerator is not zero? In the case of it being zero, couldn't we canonicalize even more by setting the denominator to 1?

c = inv(content(den))
num *= c
den *= c
Comment on lines +1092 to +1094
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
c = inv(content(den))
num *= c
den *= c
c = content(den)
num = divexact(num, c)
den = divexact(den, c)

A long time ago someone (you) told me that I should not use inv when doing division :)

end
return new{T}(num, den, R)
end
end
Expand Down
Loading