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

Ensure correct rounding for irrationals #617

Merged
merged 6 commits into from
Jan 19, 2024

Conversation

OlivierHnt
Copy link
Member

Fixes #616.

@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (946493a) 84.07% compared to head (69236c0) 84.33%.

❗ Current head 69236c0 differs from pull request most recent head 885ce8c. Consider uploading reports for the commit 885ce8c to get more accurate results

Files Patch % Lines
src/intervals/construction.jl 94.44% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #617      +/-   ##
==========================================
+ Coverage   84.07%   84.33%   +0.26%     
==========================================
  Files          24       25       +1     
  Lines        2091     2088       -3     
==========================================
+ Hits         1758     1761       +3     
+ Misses        333      327       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Joel-Dahne
Copy link
Contributor

I took a quick look at the code and didn't spot anything odd. I don't understand the distinction between _unsafe_bareinterval and __unsafe_bareinterval though?

You could also support Irrational{:ℯ} by simply evaluating exp(BareInterval{T}(1)) and taking those endpoints.

It would of course be possible to support more irrationals by simply evaluating them with interval arithmetic. They would in general not be correctly (but faithfully) rounded in those cases though. I don't know what guarantees you give on correct rounding outside of the standard though (and the standard clearly doesn't covers these types of irrationals).

@OlivierHnt
Copy link
Member Author

I took a quick look at the code and didn't spot anything odd. I don't understand the distinction between _unsafe_bareinterval and __unsafe_bareinterval though?

Oh just a way to fix method ambiguities when we introduce Irrational in the functions type signature.

You could also support Irrational{:ℯ} by simply evaluating exp(BareInterval{T}(1)) and taking those endpoints.

It would of course be possible to support more irrationals by simply evaluating them with interval arithmetic. They would in general not be correctly (but faithfully) rounded in those cases though. I don't know what guarantees you give on correct rounding outside of the standard though (and the standard clearly doesn't covers these types of irrationals).

Indeed, same for . Well for such cases, I think it suffices for the returned interval to contain the true value without necessarily be tight.

@Joel-Dahne
Copy link
Contributor

For :ℯ it would even be tight!

I think non-tight enclosures would be perfectly fine for irrationals. Personally I don't care much for correct rounding (faithful rounding is of course necessary though!), you lose it after doing two operations anyway.

In that case I think it would make sense to also implement in this PR! Then all irrationals in Base are covered at least.

@OlivierHnt
Copy link
Member Author

Sounds good, I'll find time to make the changes. Thx for looking over this PR btw!

@OlivierHnt OlivierHnt merged commit 1d744c3 into JuliaIntervals:master Jan 19, 2024
16 checks passed
@OlivierHnt OlivierHnt deleted the irrationals branch January 19, 2024 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect rounding for extreme irrationals
3 participants