-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completes c-xsc.jl #393
Completes c-xsc.jl #393
Conversation
Had to make dummy commits since appveyor was not running on this PR. Finally, running now! |
Is this ready? |
Yes! |
@@ -327,3 +328,30 @@ end | |||
hypot(a::Interval{BigFloat}, b::Interval{BigFloat}) = sqrt(a^2 + b^2) | |||
|
|||
hypot(a::Interval{T}, b::Interval{T}) where T= atomic(Interval{T}, hypot(big53(a), big53(b))) | |||
|
|||
function nthroot(a::Interval{BigFloat}, n::Integer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a docstring is always good.
src/intervals/functions.jl
Outdated
b = interval(low , high) | ||
return b | ||
end | ||
if n < 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an elseif
. Also the case n == 0
is absent, both from here and from the tests below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, I had missed your comments, just saw them.
0th
root is not defined, have added code to return empty interval
@@ -390,3 +390,30 @@ end | |||
@test hull(v...) == II | |||
@test hull(v) == II | |||
end | |||
|
|||
@testset "nthroot test" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some tests for BigFloat
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in numeric.jl
src/intervals/functions.jl
Outdated
function nthroot(a::Interval{T}, n::Integer) where T | ||
n == 1 && return a | ||
n < 0 && a == zero(a) && return emptyinterval(a) | ||
isempty(a) && return a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The special case for n == 1
, n < 0 && a == zero(a)
and isempty(a)
are missing in the BigFloat
implementation. Any reason for that?
Also it would be good to explicitly test for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the special case has been added for BigFloat
implementation. Tests are in numeric.jl
Looks good to me, thanks! |
Added nthroot function