-
Notifications
You must be signed in to change notification settings - Fork 71
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
Document PowerMode
#674
Comments
Possibly we need |
This was implemented in a previous version. See https://github.com/JuliaIntervals/IntervalArithmetic.jl/pull/286/files |
Yep it's still in the library I believe. The default is |
Unless you think we can improve the performance of the more accurate version, then I think we can close this issue. |
Ah, I see 🤦 Thank you! Is this documented? |
No it does not seem to be in the docs. |
PowerMode
I don't see any mechanism to get the current power mode? I need this so that I can save the current power mode before fixing it to run the IntervalContractor.jl tests, then reset it to the previous value. |
Usage: julia> setdisplay(:full);
julia> interval(8.673020346900622e8, 8.673020346900623e8)^(1//8)
Interval{Float64}(13.099999999999998, 13.100000000000005, com, NG)
julia> IntervalArithmetic.power_mode() = IntervalArithmetic.PowerMode{:slow}()
julia> interval(8.673020346900622e8, 8.673020346900623e8)^(1//8)
Interval{Float64}(13.099999999999998, 13.100000000000001, com, NG) |
Ah, to get the current value you just do
! |
When trying to change the power mode in the IntervalContractors.jl tests and then running
Is this expected / normal? |
Yes, that's just a warning emitted by Julia. |
Currently to compute
(1..2)^(1//7)
we are converting the rational to an interval. This loses accuracy.We should instead use the corresponding MPFR function,
mpfr_rootn_si
. Unfortunately Julia does not seem to do this yet; issue here.For rationals whose denominator is a power of 2, we can alternatively use iterated
sqrt
to get a fast version that avoidsBigFloat
s (but may not be correctly rounded).As an example, tests in IntervalContractors.jl (which are originally based on ITF1788, IIRC) are failing due to this. For example,
has a
sup
of 13.100000000000005, whereas it should be 13.100000000000001 (i.e. the result is 2 floats too large).The text was updated successfully, but these errors were encountered: