-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
BUG: ^(::Float64, ::Union{Int, Float64})
incorrect for very large negative exponents
#53881
Comments
Base.Math.pow_body(::Float64, typemin(Int)
failingBase.Math.pow_body(::Float64, typemin(Int))
failing
Further investigation shows, that the powers of big integers are unreliable for ~ The first column uses
|
Base.Math.pow_body(::Float64, typemin(Int))
failing^(::Float64, ::Union{Int, Float64})
failing
^(::Float64, ::Union{Int, Float64})
failing^(::Float64, ::Union{Int, Float64})
incorrect for very large negative exponents
The issue here is that Line 1322 in e07c0f1
|
Ah, I see. We still are missing compensation somewhere here: julia> ulps(b, x) = abs(b^x - Float64(big(b)^x))/eps(b^x)
ulps (generic function with 3 methods)
julia> [ulps(prevfloat(1.0), -2^e) for e in 26:54]
29-element Vector{Float64}:
0.0
1.0
2.0
8.0
32.0
128.0
512.0
2048.0
8192.0
32768.0
131073.0
524302.0
2.097258e6
8.389461e6
3.3561258e7
1.34272348e8
5.37307984e8
2.15098174e9
8.617942835e9
3.4584177964e10
1.3924045658e11
5.6426422088e11
2.316653480914e12
9.762831672521e12
4.3352610026219e13
2.13851005933614e14
1.304153939836051e15
2.0538755963422595e23
8.723923242651639e15 |
When I fixed the first issue ( |
@KlausC that suggests something you were doing is wrong. From what I can tell, this appears to be an issue caused by me skipping a term in the error compensation that is very small but can accumulate to a significant amount. At this point, I believe that I have corrected for the case of power of 2 exponents, but not for the case of exponents with bits set. |
That is possible. I fixed the first issue primarily. As a side-effect the exploding errors for |
BTW, I repeated the ULPs counting after my fix:
|
what about |
Also fine:
|
The floating point power function fails for a border case of integer argument:
The bug seems to be here: Base.Math.pow_body(::Float64, ::Integer)
The text was updated successfully, but these errors were encountered: