-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix BigFloat for Julia v1.12 #307
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #307 +/- ##
==========================================
- Coverage 91.85% 90.41% -1.44%
==========================================
Files 23 22 -1
Lines 2246 2222 -24
==========================================
- Hits 2063 2009 -54
- Misses 183 213 +30 ☔ View full report in Codecov by Sentry. |
I don't understand this well enough to figure out what's going on here. |
I guess a bunch of our C calls might be invalid now? julia> x, y = setprecision(BigFloat, 32) do
return rand(BigFloat, 1), rand(BigFloat, 1)
end
(BigFloat[0.51086560986], BigFloat[0.18767778529])
julia> accurate = LinearAlgebra.dot(x, y)
0.095878126238614356830099183515159211310674436390399932861328125
julia> output = setprecision(BigFloat, 32) do
buf = MA.buffer_for(LinearAlgebra.dot, Vector{BigFloat}, Vector{BigFloat})
output = BigFloat(0)
MA.buffered_operate_to!!(buf, output, LinearAlgebra.dot, x, y)
return output
end
get_str.c:157: MPFR assertion failed: size_s1 >= m
[48611] signal 6: Abort trap: 6
in expression starting at REPL[85]:1
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
pthread_kill at /usr/lib/system/libsystem_pthread.dylib (unknown line)
abort at /usr/lib/system/libsystem_c.dylib (unknown line)
mpfr_assert_fail at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
mpfr_get_str_aux at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
mpfr_get_str at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
regular_eg at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
sprnt_fp at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
mpfr_vasnprintf_aux at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
mpfr_asprintf at /Users/oscar/.julia/juliaup/julia-nightly/lib/julia/libmpfr.6.dylib (unknown line)
string_mpfr at ./mpfr.jl:1187
_string at ./mpfr.jl:1233
_string at ./mpfr.jl:1235 [inlined]
show at ./mpfr.jl:1245
show at ./multimedia.jl:47
unknown function (ip: 0x104e1d5e2) This PR seems suspicous JuliaLang/julia#55906 |
The printing is actually happened when we try to show the output. Surprisingly, replacing |
Here is the MWE a = one(BigFloat)
b = zero(BigFloat)
ccall((:mpfr_swap, :libmpfr), Cvoid, (Ref{BigFloat}, Ref{BigFloat}), b, a)
show(b) It gives
|
Okay. I tidied things up. Our previous implementation was just needlessly complicated with layers of indirection. |
No description provided.