File indexing completed on 2025-01-18 09:42:24
0001
0002
0003
0004
0005
0006 #ifndef BOOST_MP_MAX_DIGITS10_HPP
0007 #define BOOST_MP_MAX_DIGITS10_HPP
0008
0009 namespace boost {
0010 namespace multiprecision {
0011 namespace detail {
0012
0013 template <unsigned digits>
0014 struct calc_max_digits10
0015 {
0016 static constexpr unsigned max_digits_10(unsigned d)
0017 {
0018
0019
0020
0021
0022
0023
0024
0025 return static_cast<unsigned>(0.301029995663981195213738894724493026768189881462108541310 * d) + 2;
0026 }
0027 static constexpr unsigned value = max_digits_10(digits);
0028 };
0029
0030 template <std::size_t digits>
0031 struct calc_max_digits10_s
0032 {
0033 static constexpr std::size_t max_digits_10(std::size_t d)
0034 {
0035
0036
0037
0038
0039
0040
0041
0042 return static_cast<std::size_t>(static_cast<std::size_t>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d)) + 2u);
0043 }
0044 static constexpr std::size_t value = max_digits_10(digits);
0045 };
0046
0047 template <unsigned digits>
0048 struct calc_digits10
0049 {
0050 static constexpr unsigned digits_10(unsigned d)
0051 {
0052
0053
0054
0055
0056
0057 return static_cast<unsigned>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d - 1u));
0058 }
0059 static constexpr unsigned value = digits_10(digits);
0060 };
0061
0062 template <std::size_t digits>
0063 struct calc_digits10_s
0064 {
0065 static constexpr std::size_t digits_10(std::size_t d)
0066 {
0067
0068
0069
0070
0071
0072 return static_cast<std::size_t>(0.301029995663981195213738894724493026768189881462108541310 * static_cast<double>(d - 1u));
0073 }
0074 static constexpr std::size_t value = digits_10(digits);
0075 };
0076
0077 }}}
0078
0079 #endif