Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Integer and Fractional Part Splitting (modf)

#include <boost/math/special_functions/modf.hpp>
template <class T>
T modf(const T& v, T* ipart);

template <class T, class Policy>
T modf(const T& v, T* ipart, const Policy&);

template <class T>
T modf(const T& v, int* ipart);

template <class T, class Policy>
T modf(const T& v, int* ipart, const Policy&);

template <class T>
T modf(const T& v, long* ipart);

template <class T, class Policy>
T modf(const T& v, long* ipart, const Policy&);

template <class T>
T modf(const T& v, long long* ipart);

template <class T, class Policy>
T modf(const T& v, long long* ipart, const Policy&);

The modf functions store the integer part of v in *ipart and return the fractional part of v. The sign of the integer and fractional parts are the same as the sign of v.

If the argument v is either non-finite or else outside the range of the result type, then returns the result of rounding_error: by default this throws an instance of boost::math::rounding_error.


PrevUpHomeNext