mirror of
https://github.com/boostorg/charconv.git
synced 2026-02-03 09:02:11 +00:00
Add __float128 overload
This commit is contained in:
@@ -778,6 +778,11 @@ BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, double val
|
||||
BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, long double value,
|
||||
chars_format fmt = chars_format::general, int precision = -1 ) noexcept;
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
BOOST_CHARCONV_DECL to_chars_result to_chars(char* first, char* last, __float128 value,
|
||||
chars_format fmt = chars_format::general, int precision = -1 ) noexcept;
|
||||
#endif
|
||||
|
||||
} // namespace charconv
|
||||
} // namespace boost
|
||||
|
||||
|
||||
@@ -616,4 +616,21 @@ boost::charconv::to_chars_result boost::charconv::to_chars( char* first, char* l
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_FLOAT128
|
||||
|
||||
boost::charconv::to_chars_result to_chars(char* first, char* last, __float128 value, boost::charconv::chars_format fmt, int precision) noexcept
|
||||
{
|
||||
if (first > last)
|
||||
{
|
||||
return {last, std::errc::invalid_argument};
|
||||
}
|
||||
|
||||
(void)fmt;
|
||||
(void)precision;
|
||||
const auto fd128 = boost::charconv::detail::ryu::float128_to_fd128(value);
|
||||
const auto num_chars = boost::charconv::detail::ryu::generic_to_chars(fd128, first);
|
||||
|
||||
return { first + num_chars, std::errc() };
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user