| Home | Libraries | People | FAQ | More

#### 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.