// Copyright 2023 Matt Borland // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include #include #include #include #include #include #include #include #include #include // MSVC uses long double = double // Darwin sometimes uses double-double instead of long double #if BOOST_CHARCONV_LDBL_BITS > 64 && !defined(__APPLE__) && !defined(_WIN32) && !defined(_WIN64) using boost::charconv::detail::compute_float80; using boost::charconv::detail::uint128; template inline void test_fast_path() { std::errc success; BOOST_TEST_EQ(compute_float80(1, T(1), false, success), 10.0L); BOOST_TEST_EQ(compute_float80(1, T(1), true, success), -10.0L); BOOST_TEST_EQ(compute_float80(27, T(1) << 112, false, success), 5.1922968585348276285304963292200960000000000000000e60L); BOOST_TEST_EQ(compute_float80(27, T(1) << 112, true, success), -5.1922968585348276285304963292200960000000000000000e60L); } int main() { test_fast_path(); #ifdef BOOST_CHARCONV_HAS_INT128 test_fast_path(); #endif return boost::report_errors(); } #else int main() { return 0; } #endif