Switch fabs for std::abs in new adaptive Adams-Bashforth-Moulton stepper #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have been experimenting with the new adaptive Adams-Bashforth-Moulton stepper recently merged into odeint-v2. However, I've noticed that it doesn't play so well with floating-point value types other than
double
because some code incontrolled_adams_bashforth_moulton.hpp
,adaptive_adams_coefficients.hpp
andpid_step_adjuster.hpp
extract absolute values usingfabs()
without a namespace qualifier.My understanding is that unqualified
fabs()
doesn't have overloads for types other than double (eg. http://www.cplusplus.com/reference/cmath/fabs/) — for example, at least on my platform there is already a problem at the level of usinglong double
which clang warns will be implicitly narrowed todouble
. My understanding is that onlystd::fabs()
orstd::abs()
have overloads for other types, and this seems to fit with the rest of odeint-v2 wherestd::abs()
is normally used except for some parts of thevexcl
interface.This patch changes the uses of
fabs()
forstd::abs()
in just the three files mentioned at the top.