Some projects require specific trigonometric functions, a library for numerically solving ordinary differential equations and working with distributions and constants. All those parts of Boost.Math
will be hard to fit even in a separate book. A single recipe definitely won't be enough. So, let's focus on very basic everyday-use functions to work with float types.
We'll write a portable function that checks input value for infinity and Not-a-Number (NaN) values and changes the sign if the value is negative.
Basic knowledge of C++ is required for this recipe. Those who know C99 standard will find a lot common in this recipe.
Perform the following steps to check the input value for infinity and NaN values and change the sign if the value is negative:
- We need the following headers:
#include <boost/math/special_functions.hpp> #include <cassert>
- Asserting for infinity and NaN can be done like this:
template <class T> void...