Commit 6b51cb7
committed
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` precision1 parent fa3ca0f commit 6b51cb7
1 file changed
+27
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
64 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 84 | + | |
| 85 | + | |
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
| |||
0 commit comments