JuliaMath / JuliaMath/Polynomials.jl
Conversions to and from RationalFunction broken
- Dominant language
- Julia
- Stars
- 320
- Forks
- 80
- Avg merge
- 8h 46m
- Merged PRs (30d)
- 3
Description
Julia nightly demands that `convert(T, x)` produce a result of type `T`. This is currently not the case with `RationalPolynomials`, where `promote_rule` at various places hard-codes `Polynomial` instead of using a proper promotion. As a consequence, the following is broken (and tests fail on Julia nightly in general):
```julia
julia> r = SparsePolynomial([1,2], :x)
(SparsePolynomial(1 + 2*x)
julia> rr = r // (r-1)
(1 + 2*x) // (2*x)
julia> oftype(rr, r)
ERROR: TypeError: in typeassert, expected RationalFunction{Int64, :x, SparsePolynomial{Int64, :x}}, got a value of type RationalFunction{Int64, :x, Polynomial{Int64, :x}}
Stacktrace:
[1] oftype(x::RationalFunction{Int64, :x, SparsePolynomial{Int64, :x}}, y::SparsePolynomial{Int64, :x})
@ Base ./essentials.jl:641
[2] top-level scope
@ REPL[12]:1
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.