Skip to content

Commit 687d788

Browse files
authored
conversion from ChebyshevT; close issue #372 (#373)
* conversion from ChebyshevT; close issue #372 * doctest fix
1 parent ecad0cc commit 687d788

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Polynomials"
22
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
33
license = "MIT"
44
author = "JuliaMath"
5-
version = "2.0.19"
5+
version = "2.0.20"
66

77
[deps]
88
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"

docs/src/polynomials/chebyshev.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ChebyshevT(1⋅T_0(x) + 3⋅T_2(x) + 4⋅T_3(x))
3131
3232
3333
julia> p = convert(Polynomial, c)
34-
Polynomial(-2.0 - 12.0*x + 6.0*x^2 + 16.0*x^3)
34+
Polynomial(-2 - 12*x + 6*x^2 + 16*x^3)
3535
3636
julia> convert(ChebyshevT, p)
3737
ChebyshevT(1.0⋅T_0(x) + 3.0⋅T_2(x) + 4.0⋅T_3(x))

src/polynomials/ChebyshevT.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ end
5757
@register ChebyshevT
5858

5959
function Base.convert(P::Type{<:Polynomial}, ch::ChebyshevT)
60-
T = eltype(P)
60+
61+
T = _eltype(P,ch)
6162
X = indeterminate(P,ch)
6263
Q = (P){T,X}
6364

test/ChebyshevT.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ end
166166
# issue 326 evaluate outside of domain
167167
@test Polynomials.evalpoly(2, c1, false) fn(2)
168168
@test Polynomials.evalpoly(3, c1, false) fn(3)
169-
169+
170170
# GCD
171171
c1 = ChebyshevT([1, 2, 3])
172172
c2 = ChebyshevT([3, 2, 1])
@@ -221,6 +221,12 @@ end
221221
# issue #295
222222
x = BigFloat[-2/3, -1/3, 1/3, 2/4]
223223
y = BigFloat[1, 2, 3, 4]
224-
fit(ChebyshevT, x, y, 1)
224+
fit(ChebyshevT, x, y, 1)
225+
226+
# issue #372
227+
xs = [0,0,1]
228+
@test eltype(convert(Polynomial, ChebyshevT{Float64}(xs))) == Float64
229+
@test eltype(convert(Polynomial, ChebyshevT{BigFloat}(xs))) == BigFloat
230+
@test eltype(convert(Polynomial{BigFloat}, ChebyshevT(xs))) == BigFloat
225231

226232
end

0 commit comments

Comments
 (0)