Skip to content

Commit 079bccb

Browse files
authored
adjust printing tohandle symbolic values (#324)
1 parent 685a691 commit 079bccb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/polynomials/standard-basis.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ abstract type StandardBasisPolynomial{T} <: AbstractPolynomial{T} end
44

55
function showterm(io::IO, ::Type{<:StandardBasisPolynomial}, pj::T, var, j, first::Bool, mimetype) where {T}
66

7-
if iszero(pj) return false end
7+
if pj === zero(T) return false end
88

99
pj = printsign(io, pj, first, mimetype)
1010

11-
if !(pj == one(T) && !(showone(T) || j == 0))
11+
if !(pj === one(T) && !(showone(T) || j == 0))
1212
printcoefficient(io, pj, j, mimetype)
1313
end
1414

src/show.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ export printpoly
1010
hasneg(::Type{T}) where {T} = false
1111

1212
"Could value possibly be negative and if so, is it?"
13-
isneg(pj::T) where {T} = hasneg(T) && pj < zero(T)
13+
isneg(pj::T) where {T} = hasneg(T) && sign(pj) === -one(T)
1414

1515
"Make `pj` positive if it is negative. (Don't call `abs` as that may not be defined, or appropriate.)"
16-
aspos(pj::T) where {T} = (hasneg(T) && isneg(pj)) ? -pj : pj
16+
aspos(pj::T) where {T} = (hasneg(T) && isneg(pj) == true) ? -pj : pj
1717

1818
"Should a value of `one(T)` be shown as a coefficient of monomial `x^i`, `i >= 1`? (`1.0x^2` is shown, `1 x^2` is not)"
1919
showone(::Type{T}) where {T} = true

0 commit comments

Comments
 (0)