]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/math/special_functions/modf.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / special_functions / modf.hpp
1 // Copyright John Maddock 2007.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #ifndef BOOST_MATH_MODF_HPP
7 #define BOOST_MATH_MODF_HPP
8
9 #ifdef _MSC_VER
10 #pragma once
11 #endif
12
13 #include <boost/math/special_functions/math_fwd.hpp>
14 #include <boost/math/tools/config.hpp>
15 #include <boost/math/special_functions/trunc.hpp>
16
17 namespace boost{ namespace math{
18
19 template <class T, class Policy>
20 inline T modf(const T& v, T* ipart, const Policy& pol)
21 {
22 *ipart = trunc(v, pol);
23 return v - *ipart;
24 }
25 template <class T>
26 inline T modf(const T& v, T* ipart)
27 {
28 return modf(v, ipart, policies::policy<>());
29 }
30
31 template <class T, class Policy>
32 inline T modf(const T& v, int* ipart, const Policy& pol)
33 {
34 *ipart = itrunc(v, pol);
35 return v - *ipart;
36 }
37 template <class T>
38 inline T modf(const T& v, int* ipart)
39 {
40 return modf(v, ipart, policies::policy<>());
41 }
42
43 template <class T, class Policy>
44 inline T modf(const T& v, long* ipart, const Policy& pol)
45 {
46 *ipart = ltrunc(v, pol);
47 return v - *ipart;
48 }
49 template <class T>
50 inline T modf(const T& v, long* ipart)
51 {
52 return modf(v, ipart, policies::policy<>());
53 }
54
55 template <class T, class Policy>
56 inline T modf(const T& v, long long* ipart, const Policy& pol)
57 {
58 *ipart = lltrunc(v, pol);
59 return v - *ipart;
60 }
61 template <class T>
62 inline T modf(const T& v, long long* ipart)
63 {
64 return modf(v, ipart, policies::policy<>());
65 }
66
67 }} // namespaces
68
69 #endif // BOOST_MATH_MODF_HPP