From 257af038bffceb0f399de6b7b2692db7cc15f165 Mon Sep 17 00:00:00 2001 From: john verzani Date: Thu, 13 Feb 2025 13:02:46 -0500 Subject: [PATCH] close #596 (#597) * close #596 --- Project.toml | 2 +- _typos.toml | 3 ++- src/common.jl | 7 +++++-- test/rational-functions.jl | 4 ++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 80369491..fcc3c362 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "Polynomials" uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" license = "MIT" author = "JuliaMath" -version = "4.0.16" +version = "4.0.17" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/_typos.toml b/_typos.toml index 658ef090..b3050ec9 100644 --- a/_typos.toml +++ b/_typos.toml @@ -1,2 +1,3 @@ [default.extend-words] -Pn = "Pn" \ No newline at end of file +Pn = "Pn" +zerod = "zerod" \ No newline at end of file diff --git a/src/common.jl b/src/common.jl index a7c2a8e5..b5465360 100644 --- a/src/common.jl +++ b/src/common.jl @@ -1347,8 +1347,11 @@ function Base.isapprox(p1::AbstractPolynomial{T,X}, end end -Base.isapprox(p1::AbstractPolynomial{T}, n::S;kwargs...) where {S,T} = isapprox(p1, n*one(p1)) -Base.isapprox(n::S,p1::AbstractPolynomial{T}; kwargs...) where {S,T} = isapprox(p1, n; kwargs...) +Base.isapprox(p1::AbstractPolynomial{T}, n::S;kwargs...) where {S,T} = + isapprox(promote(p1, n)...; kwargs...) +# isapprox(p1, n*one(p1)) +Base.isapprox(n::S,p1::AbstractPolynomial{T}; kwargs...) where {S,T} = + isapprox(p1, n; kwargs...) Base.isapprox(::AbstractPolynomial{T}, ::Missing, args...; kwargs...) where T = missing Base.isapprox(::Missing, ::AbstractPolynomial{T}, args...; kwargs...) where T = missing diff --git a/test/rational-functions.jl b/test/rational-functions.jl index 31078cdd..7af60ba6 100644 --- a/test/rational-functions.jl +++ b/test/rational-functions.jl @@ -91,6 +91,10 @@ using LinearAlgebra @test degree(numerator(q^2 // q)) == 0 @test degree(denominator(q^2 // q)) == 1 + # issue 596 + p = Polynomial([0,1]) + r = p//1 + @test (p//1) ≈ p end @testset "zeros, poles, residues" begin