Repository navigation
Minor tweaks for a small gain in configure safety - #783
Merged
Merged
Conversation
The configuration manual now states that a new configuration applies only to code that starts running after `configure` returns to the REPL (top level), with `Base.invokelatest` as the way to reach it from the same function. It also states that each change invalidates compiled methods.
The enclosures of `ℯ` and `φ` are computed with
`IntervalRounding{:correct}` explicitly instead of through interval
arithmetic that consults `default_rounding()`. This keeps the constants
rigorous under `configure(rounding = :none)`, where
`bareinterval(BigFloat, ℯ)` and `bareinterval(BigFloat, φ)` were thin.
It also removes the configuration dependence from the generator of
`bareinterval(::Type{T}, ::AbstractIrrational)`, whose result is cached
at first generation and is not tracked by method invalidation.
Results under `:correct` and `:ulp` are unchanged.
Assisted-by: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
Member
|
That seems like the right thing to do, after all N.B.: the error on CI is unrelated. We have issues with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As promised, here is the result of an audit on
IntervalArithmetic.configure. The bottom line is that there appears to be no substantive problem: the design plays well with Julia's invalidation, and it's difficult to trigger surprising behavior.This has two small commits:
configureso that users know what to expect@generated bareinterval(::Type{T}, ::AbstractIrrational)independent of rounding mode, so that the constant is correct for all. This is a tough call, but I think this is probably the best choice: the compiled result doesn't store backedges to the generator, and it's the generator that computes theBigFloatvalue of the constant and then rounds it, the values were not updated for different rounding modes. So the safe thing to do is return the most conservative answer accurate for all rounding modes, regardless of the value of the setting at the time the function was compiled. The one and only behavior change I know of is forbareintervalwith rounding mode:none.This sequence shows what happens on
master:And here's what happens with the second commit (i.e., an interval that's safe regardless of the instantaneous value of the rounding mode):
There's a genuine choice to be made about the second commit; if you don't like it, I can strip it out.