You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
don't mutate globals when constructing Rational from AbstractIrrational
Relying on `ScopedValues`, set `BigFloat` precision without mutating
the global default, while constructing `Rational` from
`AbstractIrrational`.
Also helps avoid reading the global defaults for the precision and
rounding mode, together with JuliaLang#56095.
What does this fix:
* in the case of the `Irrational` constants defined in `MathConstants`:
relevant methods have `@assume_effects :foldable` applied, which
includes `:effect_free`, which requires that no globals be mutated
(followup on JuliaLang#55886)
* in the case of `AbstractIrrational` values in general, this PR
prevents data races on the global `BigFloat` precision
Rational{T}(x::AbstractIrrational) where {T<:Integer} =_irrational_to_rational(T, x)
78
98
_throw_argument_error_irrational_to_rational_bigint() =throw(ArgumentError("Cannot convert an AbstractIrrational to a Rational{BigInt}: use rationalize(BigInt, x) instead"))
0 commit comments