Skip to content

Commit

Permalink
Merge pull request #2017 from eggrobin/nan-norm
Browse files Browse the repository at this point in the history
Do not try ordering NaN
pleroy authored Dec 6, 2018
2 parents e1f4c52 + d9f36a8 commit 773e6fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions physics/geopotential_body.hpp
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ using quantities::ArcTan;
using quantities::Cos;
using quantities::Derivative;
using quantities::Length;
using quantities::NaN;
using quantities::Pow;
using quantities::Sqrt;
using quantities::Sin;
@@ -594,6 +595,11 @@ Geopotential<Frame>::GeneralSphericalHarmonicsAcceleration(
Length const& r_norm,
Square<Length> const& r²,
Exponentiation<Length, -3> const& one_over_r³) const {
if (r_norm != r_norm) {
// Short-circuit NaN, to avoid having to deal with an unordered
// |r_norm| when finding the partition point below.
return NaN<ReducedAcceleration>() * Vector<double, Frame>{};
}
// |limiting_degree| is the first degree such that
// |r_norm >= degree_damping_[limiting_degree].outer_threshold()|, or is
// |degree_damping_.size()| if |r_norm| is below all thresholds.

0 comments on commit 773e6fb

Please sign in to comment.