Skip to content

Commit 6db10d9

Browse files
authored
Update and simplify NaN-safe mode instructions
1 parent f00147e commit 6db10d9

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

docs/src/user/advanced.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,20 @@ ForwardDiff's `NaN`-safe mode by using the
149149
the `nansafe_mode` preference to true, for example via:
150150

151151
```julia
152-
julia> using ForwardDiff, Preferences
152+
julia> using Preferences
153153

154154
julia> set_preferences!(ForwardDiff, "nansafe_mode" => true)
155-
```
156-
157-
Note that Julia has to be restarted and ForwardDiff has to be reloaded after changing
158-
this preference.
159-
160-
Alternatively, you can set the preference before loading ForwardDiff, for example via:
161-
162-
```julia
163-
julia> using Preferences, UUIDs
164-
165-
julia> set_preferences!(UUID("f6369f11-7733-5829-9624-2563aa707210"), "nansafe_mode" => true)
166155

167156
julia> using ForwardDiff
168157

169158
julia> log(ForwardDiff.Dual{:tag}(0.0, 0.0))
170159
Dual{:tag}(-Inf,0.0)
171160
```
172161

162+
!!! warn
163+
The preference has to be set **before** loading ForwardDiff.
164+
If you change it after loading ForwardDiff, you have to restart your Julia session and reload ForwardDiff for it to become active.
165+
173166
In the future, we plan on allowing users and downstream library authors to dynamically
174167
enable [`NaN`-safe mode via the `AbstractConfig`
175168
API](https://github.com/JuliaDiff/ForwardDiff.jl/issues/181).

0 commit comments

Comments
 (0)