Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:19

0001 //  Copyright John Maddock 2007.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #ifndef BOOST_MATH_MODF_HPP
0007 #define BOOST_MATH_MODF_HPP
0008 
0009 #ifdef _MSC_VER
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/math/special_functions/math_fwd.hpp>
0014 #include <boost/math/tools/config.hpp>
0015 #include <boost/math/special_functions/trunc.hpp>
0016 
0017 namespace boost{ namespace math{
0018 
0019 template <class T, class Policy>
0020 inline T modf(const T& v, T* ipart, const Policy& pol)
0021 {
0022    *ipart = trunc(v, pol);
0023    return v - *ipart;
0024 }
0025 template <class T>
0026 inline T modf(const T& v, T* ipart)
0027 {
0028    return modf(v, ipart, policies::policy<>());
0029 }
0030 
0031 template <class T, class Policy>
0032 inline T modf(const T& v, int* ipart, const Policy& pol)
0033 {
0034    *ipart = itrunc(v, pol);
0035    return v - *ipart;
0036 }
0037 template <class T>
0038 inline T modf(const T& v, int* ipart)
0039 {
0040    return modf(v, ipart, policies::policy<>());
0041 }
0042 
0043 template <class T, class Policy>
0044 inline T modf(const T& v, long* ipart, const Policy& pol)
0045 {
0046    *ipart = ltrunc(v, pol);
0047    return v - *ipart;
0048 }
0049 template <class T>
0050 inline T modf(const T& v, long* ipart)
0051 {
0052    return modf(v, ipart, policies::policy<>());
0053 }
0054 
0055 template <class T, class Policy>
0056 inline T modf(const T& v, long long* ipart, const Policy& pol)
0057 {
0058    *ipart = lltrunc(v, pol);
0059    return v - *ipart;
0060 }
0061 template <class T>
0062 inline T modf(const T& v, long long* ipart)
0063 {
0064    return modf(v, ipart, policies::policy<>());
0065 }
0066 
0067 }} // namespaces
0068 
0069 #endif // BOOST_MATH_MODF_HPP