Skip to content
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

sinpi returns unnecessarily wide intervals #412

Closed
fph opened this issue Sep 7, 2020 · 4 comments · Fixed by #600
Closed

sinpi returns unnecessarily wide intervals #412

fph opened this issue Sep 7, 2020 · 4 comments · Fixed by #600

Comments

@fph
Copy link

fph commented Sep 7, 2020

It looks like sinpi(x), where x is an interval, is defined internally as sin(x*\pi). Unfortunately this yields intervals that could be tightened; for instance:

julia> sinpi(1..1)
[-3.21625e-16, 1.22465e-16]

while it should be possible to determine that the result is exactly 0.

If sin were defined in terms of sinpi, instead of the opposite, with an implementation analogous to the current one, then this problem would disappear. I tried to submit a PR, but some tests fail because of a related issue I just reported in CRlibm (JuliaIntervals/CRlibm.jl#39).

@dpsanders
Copy link
Member

sin should definitely not be defined in terms of sinpi, since this will also widen the resulting interval.

But yes it should be possible to implement sinpi for Interval{Float64} in a similar, but easier way to sin.

@dpsanders
Copy link
Member

Please feel free to file the PR and we can try and find what's going wrong.

@fph
Copy link
Author

fph commented Sep 28, 2020

Filed the PR. With the implementation in the PR all tests pass, but cospi(@biginterval(0.5)) fails (because now it relies on calling CRlibm.cospi on a BigFloat, and that is undefined).

@fph
Copy link
Author

fph commented Sep 28, 2020

..oops; all tests pass on my machine, but apparently not in the CI environment, where the same stack overflow bug pops up. So there is indeed something still to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants