@@ -172,7 +172,11 @@ In-place version of [`truncate`](@ref)
172172"""
173173function truncate! (p:: AbstractPolynomial{T} ;
174174 rtol:: Real = Base. rtoldefault (real (T)),
175- atol:: Real = 0 ,) where {T}
175+ atol:: Real = 0 ,) where {T}
176+
177+ #
178+
179+
176180 max_coeff = maximum (abs, coeffs (p))
177181 thresh = max_coeff * rtol + atol
178182 map! (c-> abs (c) <= thresh ? zero (T) : c, coeffs (p), coeffs (p))
@@ -392,7 +396,7 @@ Base.broadcastable(p::AbstractPolynomial) = Ref(p)
392396function basis (:: Type{P} , k:: Int , _var:: SymbolLike = :x ; var= _var) where {P <: AbstractPolynomial }
393397 zs = zeros (Int, k+ 1 )
394398 zs[end ] = 1
395- P (zs, var)
399+ ⟒ (P){ eltype (P)} (zs, var)
396400end
397401basis (p:: P , k:: Int , _var:: SymbolLike = :x ; var= _var) where {P<: AbstractPolynomial } = basis (P, k, var)
398402
@@ -452,15 +456,15 @@ Base.hash(p::AbstractPolynomial, h::UInt) = hash(p.var, hash(coeffs(p), h))
452456
453457Returns a representation of 0 as the given polynomial.
454458"""
455- Base. zero (:: Type{P} , var= :x ) where {P <: AbstractPolynomial } = P (zeros (eltype (P), 1 ), var)
459+ Base. zero (:: Type{P} , var= :x ) where {P <: AbstractPolynomial } = ⟒ (P) (zeros (eltype (P), 1 ), var)
456460Base. zero (p:: P ) where {P <: AbstractPolynomial } = zero (P, p. var)
457461"""
458462 one(::Type{<:AbstractPolynomial})
459463 one(::AbstractPolynomial)
460464
461465Returns a representation of 1 as the given polynomial.
462466"""
463- Base. one (:: Type{P} , var= :x ) where {P <: AbstractPolynomial } = P (ones (eltype (P),1 ), var)
467+ Base. one (:: Type{P} , var= :x ) where {P <: AbstractPolynomial } = ⟒ (P) (ones (eltype (P),1 ), var)
464468Base. one (p:: P ) where {P <: AbstractPolynomial } = one (P, p. var)
465469
466470Base. oneunit (:: Type{P} , args... ) where {P <: AbstractPolynomial } = one (P, args... )
@@ -556,11 +560,11 @@ Base.:(==)(p1::AbstractPolynomial, p2::AbstractPolynomial) =
556560Base.:(== )(p:: AbstractPolynomial , n:: Number ) = degree (p) <= 0 && p[0 ] == n
557561Base.:(== )(n:: Number , p:: AbstractPolynomial ) = p == n
558562
563+
559564function Base. isapprox (p1:: AbstractPolynomial{T} ,
560565 p2:: AbstractPolynomial{S} ;
561566 rtol:: Real = (Base. rtoldefault (T, S, 0 )),
562- atol:: Real = 0 ,) where {T,S}
563-
567+ atol:: Real = 0 ,) where {T,S}
564568 p1, p2 = promote (p1, p2)
565569 check_same_variable (p1, p2) || error (" p1 and p2 must have same var" )
566570 p1t = truncate (p1; rtol = rtol, atol = atol)
@@ -569,7 +573,6 @@ function Base.isapprox(p1::AbstractPolynomial{T},
569573 return false
570574 end
571575 isapprox (coeffs (p1t), coeffs (p2t), rtol = rtol, atol = atol)
572-
573576end
574577
575578function Base. isapprox (p1:: AbstractPolynomial{T} ,
@@ -583,6 +586,7 @@ function Base.isapprox(p1::AbstractPolynomial{T},
583586 isapprox (coeffs (p1t), [n], rtol = rtol, atol = atol)
584587end
585588
589+
586590Base. isapprox (n:: S ,
587591 p1:: AbstractPolynomial{T} ;
588592 rtol:: Real = (Base. rtoldefault (T, S, 0 )),
0 commit comments