[/ Copyright Nick Thompson, 2020 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). ] [section:engel_expansion Engel Expansion] #include namespace boost::math::tools { template class engel_expansion { public: engel_expansion(Real x); std::vector const & digits() const; template friend std::ostream& operator<<(std::ostream& out, engel_expansion& engel); }; } The `engel_expansion` class provided by Boost converts a floating point number into an [@https://en.wikipedia.org/wiki/Engel_expansion Engel series]. Here's a minimal working example: using boost::math::constants::e; using boost::math::tools::engel_expansion; auto engel = engel_expansion(e()); std::cout << "e ≈ " << engel << "\n"; // Prints: // e ≈ {1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16} The digits of an Engel expansion tend to grow exponentially, so the integer template option might need to be utilized. For example, we can use a wider integer type via using boost::multiprecision::checked_int1024_t; auto engel = engel_expansion<__float128, checked_int1024_t>(pi<__float128>()); [endsect]