Skip to content

Commit

Permalink
Throw DomainError for out-of-domain evaluation (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub authored Sep 13, 2023
1 parent 9f6b745 commit 6da2557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/polynomials/chebyshev.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ julia> c.(-1:0.5:1)
```
"""
function evalpoly(x::S, ch::ChebyshevT) where {S}
x domain(ch) && throw(ArgumentError("$x outside of domain"))
d = domain(ch)
x d && throw(DomainError(x, "evaluation point must lie in $d"))
evalpoly(x, ch, false)
end

Expand Down
2 changes: 2 additions & 0 deletions test/ChebyshevT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
@test size(p, 1) == size(coeff, 1)
@test typeof(p).parameters[2] == eltype(coeff)
@test eltype(p) == eltype(coeff)

@test_throws DomainError p(2)
end
end

Expand Down

2 comments on commit 6da2557

@jverzani
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/91346

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.0.4 -m "<description of version>" 6da25579aa7008ef7e3c002b556e7a2dbbbe3f8e
git push origin v4.0.4

Please sign in to comment.