1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #ifndef BOOST_COMPUTE_DETAIL_LITERAL_HPP
- #define BOOST_COMPUTE_DETAIL_LITERAL_HPP
- #include <iomanip>
- #include <limits>
- #include <sstream>
- #include <boost/type_traits/is_same.hpp>
- #include <boost/compute/types/fundamental.hpp>
- namespace boost {
- namespace compute {
- namespace detail {
- template<class T>
- std::string make_literal(T x)
- {
- std::stringstream s;
- s << std::setprecision(
- #ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
- std::numeric_limits<T>::max_digits10
- #else
-
-
- 3 + std::numeric_limits<T>::digits10
- #endif
- )
- << std::scientific
- << x;
- if(boost::is_same<T, float>::value || boost::is_same<T, float_>::value){
- s << "f";
- }
- return s.str();
- }
- }
- }
- }
- #endif
|