Skip to content

Commit 7245a87

Browse files
committed
Implement isreal, real & isintegral using map & all
1 parent e3c8815 commit 7245a87

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/common.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ Determine whether a polynomial is a real polynomial, i.e., having only real numb
312312
313313
See also: [`real`](@ref)
314314
"""
315-
Base.isreal(p::AbstractPolynomial) = is_(isreal, p)
315+
Base.isreal(p::AbstractPolynomial) = all(isreal, p)
316316
"""
317317
real(p::AbstractPolynomial)
318318
@@ -323,14 +323,14 @@ See also: [`isreal`](@ref)
323323
!!! note
324324
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`.
325325
"""
326-
Base.real(p::AbstractPolynomial) = as_(real, p)
326+
Base.real(p::AbstractPolynomial) = map(real, p)
327327

328328
"""
329329
isintegral(p::AbstractPolynomial)
330330
331331
Determine whether a polynomial is an integer polynomial, i.e., having only integers as coefficients.
332332
"""
333-
isintegral(p::AbstractPolynomial) = is_(isinteger, p)
333+
isintegral(p::AbstractPolynomial) = all(isinteger, p)
334334

335335
"""
336336
ismonic(p::AbstractPolynomial)

0 commit comments

Comments
 (0)