Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FPE in templated networks #1600

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions screening/screen.H
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,12 @@ void actual_screen(const plasma_state_t<dual_t>& state,
{
dual_t scor_dual;
scor_dual = actual_screen(state, scn_fac);
if constexpr (std::is_same_v<dual_t, amrex::Real>) {
scor = scor_dual;
scordt = std::numeric_limits<amrex::Real>::signaling_NaN();
} else {
if constexpr (autodiff::detail::isDual<dual_t>) {
scor = autodiff::val(scor_dual);
scordt = autodiff::derivative(scor_dual);
} else {
scor = scor_dual;
scordt = std::numeric_limits<amrex::Real>::quiet_NaN();
}
}

Expand Down
3 changes: 3 additions & 0 deletions sphinx_docs/source/autodiff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ replaced with ones in the ``admath`` namespace. This namespace also
exports the original functions, so they work fine on normal numeric
types too.

To manually check whether a type is a dual number or not, use
``autodiff::detail::isDual<dual_t>``.

Derivatives of single-variable functions
========================================

Expand Down
Loading