Skip to content

Commit 59bd213

Browse files
committed
Add isintegerpoly & asintegerpoly
1 parent 20f45f0 commit 59bd213

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/common.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export fromroots,
1515
fit,
1616
integrate,
1717
derivative,
18-
variable
18+
variable,
19+
isintegerpoly,
20+
asintegerpoly
1921

2022
"""
2123
fromroots(::AbstractVector{<:Number}; var=:x)
@@ -321,6 +323,10 @@ See also: [`isreal`](@ref)
321323
This could cause losing terms in `p`. This method is usually called on polynomials like `p = Polynomial([1, 2 + 0im, 3.0, 4.0 + 0.0im])` where you want to chop the imaginary parts of the coefficients of `p`.
322324
"""
323325
Base.real(p::AbstractPolynomial) = as_(real, p)
326+
327+
isintegerpoly(p::AbstractPolynomial) = is_(isinteger, p)
328+
asintegerpoly(p::AbstractPolynomial) = as_(x -> convert(Integer, x), p)
329+
324330
"""
325331
coeffs(::AbstractPolynomial)
326332

0 commit comments

Comments
 (0)