Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:40:06

0001 //  Copyright (c) 2009 John Maddock
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_ICONV_HPP
0007 #define BOOST_MATH_ICONV_HPP
0008 
0009 #ifdef _MSC_VER
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/math/tools/config.hpp>
0014 #include <boost/math/tools/type_traits.hpp>
0015 #include <boost/math/special_functions/round.hpp>
0016 
0017 namespace boost { namespace math { namespace detail{
0018 
0019 template <class T, class Policy>
0020 BOOST_MATH_GPU_ENABLED inline int iconv_imp(T v, Policy const&, boost::math::true_type const&)
0021 {
0022    return static_cast<int>(v);
0023 }
0024 
0025 template <class T, class Policy>
0026 BOOST_MATH_GPU_ENABLED inline int iconv_imp(T v, Policy const& pol, boost::math::false_type const&)
0027 {
0028    BOOST_MATH_STD_USING
0029    return iround(v, pol);
0030 }
0031 
0032 template <class T, class Policy>
0033 BOOST_MATH_GPU_ENABLED inline int iconv(T v, Policy const& pol)
0034 {
0035    typedef typename boost::math::is_convertible<T, int>::type tag_type;
0036    return iconv_imp(v, pol, tag_type());
0037 }
0038 
0039 
0040 }}} // namespaces
0041 
0042 #endif // BOOST_MATH_ICONV_HPP
0043