]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/math/include/boost/math/special_functions/modf.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / include / boost / math / special_functions / modf.hpp
CommitLineData
7c673cae
FG
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
17namespace boost{ namespace math{
18
19template <class T, class Policy>
20inline T modf(const T& v, T* ipart, const Policy& pol)
21{
22 *ipart = trunc(v, pol);
23 return v - *ipart;
24}
25template <class T>
26inline T modf(const T& v, T* ipart)
27{
28 return modf(v, ipart, policies::policy<>());
29}
30
31template <class T, class Policy>
32inline T modf(const T& v, int* ipart, const Policy& pol)
33{
34 *ipart = itrunc(v, pol);
35 return v - *ipart;
36}
37template <class T>
38inline T modf(const T& v, int* ipart)
39{
40 return modf(v, ipart, policies::policy<>());
41}
42
43template <class T, class Policy>
44inline T modf(const T& v, long* ipart, const Policy& pol)
45{
46 *ipart = ltrunc(v, pol);
47 return v - *ipart;
48}
49template <class T>
50inline T modf(const T& v, long* ipart)
51{
52 return modf(v, ipart, policies::policy<>());
53}
54
55#ifdef BOOST_HAS_LONG_LONG
56template <class T, class Policy>
57inline T modf(const T& v, boost::long_long_type* ipart, const Policy& pol)
58{
59 *ipart = lltrunc(v, pol);
60 return v - *ipart;
61}
62template <class T>
63inline T modf(const T& v, boost::long_long_type* ipart)
64{
65 return modf(v, ipart, policies::policy<>());
66}
67#endif
68
69}} // namespaces
70
71#endif // BOOST_MATH_MODF_HPP