Open OlivierHnt opened 10 months ago
This problem is similar to #52859. At this place I think the fix is simple, just use specify the precision explicitly with BigFloat(x, precision = precision(y) + 32)
.
However, the construction of BigFloat
from Irrational
also uses setprecision
and is hence not thread-safe. This is a harder problem to solve since when specifying irrationals one can give an arbitrary function for computing them. Here is the implementation
https://github.com/JuliaLang/julia/blob/c5d7b87a35b5beaef9d4d3aa53c0a2686f3445b9/base/irrationals.jl#L212-L240
In fact setprecision
is used in a non-safe way in three more places in that file. For construction of Rational{T]
as well as construction of Float32
and Float64
with rounding. In all of those places it would be fine to replace a constructor that explicitly specifies the precision though.
While investigating https://github.com/JuliaIntervals/IntervalArithmetic.jl/issues/612, we found out that
<
hinges onsetrounding
which is not thread safe.MWE:
This example was run using Julia v1.10
The problem seems to be here https://github.com/JuliaLang/julia/blob/c5d7b87a35b5beaef9d4d3aa53c0a2686f3445b9/base/irrationals.jl#L99-L101
cc @Kolaru and @dpsanders