From 213da6028c1310d588b4b1dc1d786b4c7ab19879 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Mon, 15 Jan 2024 10:48:36 +0100 Subject: [PATCH] intervals: pass precision to `BigFloat` instead of changing globally Taking the lock is still necessary after this change. It'd be necessary to audit all `BigFloat` methods to prove otherwise. Also see https://github.com/JuliaLang/julia/pull/49749, which fixes some of them in Julia `Base`. --- src/intervals/rounding.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/intervals/rounding.jl b/src/intervals/rounding.jl index 31dccd25..9da4a128 100644 --- a/src/intervals/rounding.jl +++ b/src/intervals/rounding.jl @@ -8,9 +8,7 @@ Create a `BigFloat` with the same underlying precision. """ function _bigequiv(x::T) where {T<:NumTypes} lock(precision_lock) do - setprecision(precision(float(T))) do - return BigFloat(x) - end + BigFloat(x, precision = precision(float(T))) end end