From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id EA4DB385780F for ; Tue, 16 Nov 2021 00:25:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA4DB385780F Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-Fq8-17DoN-eAhSzJX4HlPQ-1; Mon, 15 Nov 2021 19:25:24 -0500 X-MC-Unique: Fq8-17DoN-eAhSzJX4HlPQ-1 Received: by mail-qv1-f72.google.com with SMTP id jt9-20020a05621427e900b003c027cd9516so12565938qvb.20 for ; Mon, 15 Nov 2021 16:25:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r8G/xK+KOoPpoOduUJdo7sYA5aQ8CCX/N+qbfKnmiVE=; b=N2LRgqXyW5hoAF0iy73MhGrVRNHJYWzu2nyPH0Zvc6SRh6ABjPJnxME5t25awPHJwU aV1etfJHut20NhUxxpbB5Da15XrO/SxHJBjeOaZKC5W1pgO8FMfq+xrRzvTisUccDEhu 5C8ENozCBQpMPsE01IayVY1C2ozb0Uc9/fgDKy8BMdHRguZFJAJ5mbeGL/VCNXE2b544 uitr/oNWNiafHUlE8CvcGTXDOcD7X+DvMvb9XCMHB82jO372/Xwi0YtI1Rs3o4Ho8530 TDzHnkFaiP5jn7YPcS7UJtRZoE3IkNjUWEPw0U5YJdt5Suroj7QsVJvLFlHpAQoqpvxL /V/Q== X-Gm-Message-State: AOAM531noRKpZ3SuZnF4UYqhZAHhlGSUxwGMm1kJikRO43GNebMjfjq/ Du76tXwwyMnEJJ9M/heXosMO24G27zXSf8VJJi+LRalBTodoP2aKgzaoB1fp8my2meQFTw7l7gc EBJaQcOM3L2+dr/k= X-Received: by 2002:a05:620a:1335:: with SMTP id p21mr2735057qkj.182.1637022322192; Mon, 15 Nov 2021 16:25:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6+/Lm+qC7ZmCbac/wkW/zN70khlk8hq2KlMz/Zya4IL6G4sEL89GeRHjQ7DmiMMQN4WBPuA== X-Received: by 2002:a05:620a:1335:: with SMTP id p21mr2734998qkj.182.1637022321413; Mon, 15 Nov 2021 16:25:21 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id j19sm7836545qkp.28.2021.11.15.16.25.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 16:25:20 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 5/5] libstdc++: Import MSVC floating-point std::from_chars testcases Date: Mon, 15 Nov 2021 19:25:05 -0500 Message-Id: <20211116002505.2324582-5-ppalka@redhat.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211116002505.2324582-1-ppalka@redhat.com> References: <20211116002505.2324582-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-15.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Nov 2021 00:25:35 -0000 All testcases are added, but we temporarily disable the chars_format::hex testcases due to quirks in various strtod implementations observed during testing (e.g. ERANGE not being signalled in case of overflow, and improper rounding of subnormals) which would otherwise cause the tests to be flaky. libstdc++-v3/ChangeLog: * testsuite/20_util/from_chars/double.cc: New test, consisting of testcases extracted from the MSVC STL testsuite. * testsuite/20_util/from_chars/float.cc: New test. --- .../testsuite/20_util/from_chars/double.cc | 1680 +++++++++++++++++ .../testsuite/20_util/from_chars/float.cc | 296 +++ 2 files changed, 1976 insertions(+) create mode 100644 libstdc++-v3/testsuite/20_util/from_chars/double.cc create mode 100644 libstdc++-v3/testsuite/20_util/from_chars/float.cc diff --git a/libstdc++-v3/testsuite/20_util/from_chars/double.cc b/libstdc++-v3/testsuite/20_util/from_chars/double.cc new file mode 100644 index 00000000000..4dc1ca17865 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/from_chars/double.cc @@ -0,0 +1,1680 @@ +// This file consists of testcases extracted from the MSVC STL testsuite. + +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +// { dg-do run { target c++17 } } +// { dg-require-effective-target ieee-floats } + +#include + +#include +#include +#include + +using namespace std; + +inline constexpr double double_inf = numeric_limits::infinity(); + +struct double_from_chars_testcase { + const char* input; + chars_format fmt; + size_t correct_idx; + errc correct_ec; + double correct_value; +}; + +inline constexpr double_from_chars_testcase double_from_chars_test_cases[] = { + {"1.000000000000a000", chars_format::hex, 18, errc{}, 0x1.000000000000ap0}, // exact + {"1.000000000000a001", chars_format::hex, 18, errc{}, 0x1.000000000000ap0}, // below midpoint, round down + {"1.000000000000a800", chars_format::hex, 18, errc{}, 0x1.000000000000ap0}, // midpoint, round down to even + {"1.000000000000a801", chars_format::hex, 18, errc{}, 0x1.000000000000bp0}, // above midpoint, round up + {"1.000000000000b000", chars_format::hex, 18, errc{}, 0x1.000000000000bp0}, // exact + {"1.000000000000b001", chars_format::hex, 18, errc{}, 0x1.000000000000bp0}, // below midpoint, round down + {"1.000000000000b800", chars_format::hex, 18, errc{}, 0x1.000000000000cp0}, // midpoint, round up to even + {"1.000000000000b801", chars_format::hex, 18, errc{}, 0x1.000000000000cp0}, // above midpoint, round up + + {"1.00000000000020", chars_format::hex, 16, errc{}, 0x1.0000000000002p0}, // exact + {"1.00000000000021", chars_format::hex, 16, errc{}, 0x1.0000000000002p0}, // below midpoint, round down + {"1.00000000000028", chars_format::hex, 16, errc{}, 0x1.0000000000002p0}, // midpoint, round down to even + {"1.00000000000029", chars_format::hex, 16, errc{}, 0x1.0000000000003p0}, // above midpoint, round up + {"1.00000000000030", chars_format::hex, 16, errc{}, 0x1.0000000000003p0}, // exact + {"1.00000000000031", chars_format::hex, 16, errc{}, 0x1.0000000000003p0}, // below midpoint, round down + {"1.00000000000038", chars_format::hex, 16, errc{}, 0x1.0000000000004p0}, // midpoint, round up to even + {"1.00000000000039", chars_format::hex, 16, errc{}, 0x1.0000000000004p0}, // above midpoint, round up + + {"1.00000000000000044408920985006261616945266723632812500000", chars_format::general, 58, errc{}, + 0x1.0000000000002p0}, // exact + {"1.00000000000000045796699765787707292474806308746337890625", chars_format::general, 58, errc{}, + 0x1.0000000000002p0}, // below midpoint, round down + {"1.00000000000000055511151231257827021181583404541015624999", chars_format::general, 58, errc{}, + 0x1.0000000000002p0}, // below midpoint, round down + {"1.00000000000000055511151231257827021181583404541015625000", chars_format::general, 58, errc{}, + 0x1.0000000000002p0}, // midpoint, round down to even + {"1.00000000000000055511151231257827021181583404541015625001", chars_format::general, 58, errc{}, + 0x1.0000000000003p0}, // above midpoint, round up + {"1.00000000000000056898930012039272696711122989654541015625", chars_format::general, 58, errc{}, + 0x1.0000000000003p0}, // above midpoint, round up + {"1.00000000000000066613381477509392425417900085449218750000", chars_format::general, 58, errc{}, + 0x1.0000000000003p0}, // exact + {"1.00000000000000068001160258290838100947439670562744140625", chars_format::general, 58, errc{}, + 0x1.0000000000003p0}, // below midpoint, round down + {"1.00000000000000077715611723760957829654216766357421874999", chars_format::general, 58, errc{}, + 0x1.0000000000003p0}, // below midpoint, round down + {"1.00000000000000077715611723760957829654216766357421875000", chars_format::general, 58, errc{}, + 0x1.0000000000004p0}, // midpoint, round up to even + {"1.00000000000000077715611723760957829654216766357421875001", chars_format::general, 58, errc{}, + 0x1.0000000000004p0}, // above midpoint, round up + {"1.00000000000000079103390504542403505183756351470947265625", chars_format::general, 58, errc{}, + 0x1.0000000000004p0}, // above midpoint, round up + + // https://www.exploringbinary.com/nondeterministic-floating-point-conversions-in-java/ + {"0.0000008p-1022", chars_format::hex, 15, errc{}, 0x0.0000008p-1022}, + + // VSO-838635 ": from_chars() mishandles certain subnormals" + // These values change on half-ulp boundaries: + // 1 * 2^-1075 ~= 2.47e-324 (half-ulp between zero and min subnormal) + // 2 * 2^-1075 ~= 4.94e-324 (min subnormal) + // 3 * 2^-1075 ~= 7.41e-324 (half-ulp between min subnormal and next subnormal) + // 4 * 2^-1075 ~= 9.88e-324 (next subnormal) + {"1." + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111e-324", + chars_format::scientific, 1007, errc::result_out_of_range, 0x0.0000000000000p+0}, + {"2." + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222e-324", + chars_format::scientific, 1007, errc::result_out_of_range, 0x0.0000000000000p+0}, + {"3." + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333" + "3333333333333333333e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000001p-1022}, + {"4." + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444" + "4444444444444444444e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000001p-1022}, + {"5." + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555" + "5555555555555555555e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000001p-1022}, + {"6." + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000001p-1022}, + {"7." + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000002p-1022}, + {"8." + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000002p-1022}, + {"9." + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999e-324", + chars_format::scientific, 1007, errc{}, 0x0.0000000000002p-1022}, + + // VSO-852024: Test cases for round-to-nearest, ties-to-even. + // Consider the values: + // A: 0x1.0000000000000p+0 == 1.0000000000000000000000000000000000000000000000000000 + // X: (1 + 2^-53) * 2^0 == 1.00000000000000011102230246251565404236316680908203125 + // B: 0x1.0000000000001p+0 == 1.0000000000000002220446049250313080847263336181640625 + // X is equidistant from A and B. Because they're tied for being nearest, we need to round to even. + // That means rounding down to A, because A's least significant hexit 0 is even. + // However, values between X and B aren't tied - they're simply nearer to B, so they need to round up to B. + // We need to handle tricky cases like the digits of X, followed by a million 0 digits, followed by a 1 digit. + // Similarly: + // E: 0x1.ffffffffffffep+0 == 1.999999999999999555910790149937383830547332763671875 + // Y: (1 + 1 - 3 * 2^-53) * 2^0 == 1.99999999999999966693309261245303787291049957275390625 + // F: 0x1.fffffffffffffp+0 == 1.9999999999999997779553950749686919152736663818359375 + // The hexit E is 14 and even, while F is 15 and odd. + + // just below (0 + 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "4779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328124999", + chars_format::fixed, 1080, errc::result_out_of_range, 0x0.0000000000000p+0}, + + // (0 + 2^-53) * 2^-1022 exactly + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "4779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328125", + chars_format::fixed, 1077, errc::result_out_of_range, 0x0.0000000000000p+0}, + + // (0 + 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "4779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328125000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000", + chars_format::fixed, 2077, errc::result_out_of_range, 0x0.0000000000000p+0}, + + // above (0 + 2^-53) * 2^-1022: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "4779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328125000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00001", + chars_format::fixed, 2078, errc{}, 0x0.0000000000001p-1022}, + + // above (0 + 2^-53) * 2^-1022: appended a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "47791869486679949683240497058210285131854513962138377228261454376934125320985913276672363281251", + chars_format::fixed, 1078, errc{}, 0x0.0000000000001p-1022}, + + // above (0 + 2^-53) * 2^-1022: incremented last digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002470" + "3282292062327208828439643411068618252990130716238221279284125033775363510437593264991818081799618989828234772" + "2858865463328355177969898199387398005390939063150356595155702263922908583924491051844359318028499365361525003" + "1937045767824921936562366986365848075700158576926990370631192827955855133292783433840935197801553124659726357" + "9574622766465272827220056374006485499977096599470454020828166226237857393450736339007967761930577506740176324" + "6736009689513405355374585166611342237666786041621596804619144672918403005300575308490487653917113865916462395" + "2491262365388187963623937328042389101867234849766823508986338858792562830275599565752445550725518931369083625" + "4779186948667994968324049705821028513185451396213837722826145437693412532098591327667236328126", + chars_format::fixed, 1077, errc{}, 0x0.0000000000001p-1022}, + + // just below (0 + 1 - 3 * 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "5530270683064113556748943345076587312006145811358486831521563686919762403704226016998291015624999", + chars_format::fixed, 1080, errc{}, 0x0.ffffffffffffep-1022}, + + // (0 + 1 - 3 * 2^-53) * 2^-1022 exactly + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "5530270683064113556748943345076587312006145811358486831521563686919762403704226016998291015625", + chars_format::fixed, 1077, errc{}, 0x0.ffffffffffffep-1022}, + + // (0 + 1 - 3 * 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "5530270683064113556748943345076587312006145811358486831521563686919762403704226016998291015625000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000", + chars_format::fixed, 2077, errc{}, 0x0.ffffffffffffep-1022}, + + // above (0 + 1 - 3 * 2^-53) * 2^-1022: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "5530270683064113556748943345076587312006145811358486831521563686919762403704226016998291015625000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00001", + chars_format::fixed, 2078, errc{}, 0x0.fffffffffffffp-1022}, + + // above (0 + 1 - 3 * 2^-53) * 2^-1022: appended a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "55302706830641135567489433450765873120061458113584868315215636869197624037042260169982910156251", + chars_format::fixed, 1078, errc{}, 0x0.fffffffffffffp-1022}, + + // above (0 + 1 - 3 * 2^-53) * 2^-1022: incremented last digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072006419" + "9176395546258779936602667813027328296362349540005779643539444484102225369938322261431279727704724131030539099" + "2976863718870946851468024222968583977359185141028540361975476844303195813273469348201130421165308554532083149" + "3676067608324920106709384047261543474082573017216837765643921010648239116172158852475760231303527077156200284" + "1775343298712758123539074213191978739083589771549597066404661620550578925994422322342444472859570416955675758" + "5423752417124134805999073137808018133811049489046686648944255834488901008259721496147104204399198556535697531" + "0055231935448663898095485089604066035268185282450207861510244351362091237759797852153577038777504570568436147" + "5530270683064113556748943345076587312006145811358486831521563686919762403704226016998291015626", + chars_format::fixed, 1077, errc{}, 0x0.fffffffffffffp-1022}, + + // just below (1 + 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "4647018477736093430045142168360701364747951396213837722826145437693412532098591327667236328124999", + chars_format::fixed, 1080, errc{}, 0x1.0000000000000p-1022}, + + // (1 + 2^-53) * 2^-1022 exactly + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "4647018477736093430045142168360701364747951396213837722826145437693412532098591327667236328125", + chars_format::fixed, 1077, errc{}, 0x1.0000000000000p-1022}, + + // (1 + 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "4647018477736093430045142168360701364747951396213837722826145437693412532098591327667236328125000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000", + chars_format::fixed, 2077, errc{}, 0x1.0000000000000p-1022}, + + // above (1 + 2^-53) * 2^-1022: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "4647018477736093430045142168360701364747951396213837722826145437693412532098591327667236328125000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00001", + chars_format::fixed, 2078, errc{}, 0x1.0000000000001p-1022}, + + // above (1 + 2^-53) * 2^-1022: appended a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "46470184777360934300451421683607013647479513962138377228261454376934125320985913276672363281251", + chars_format::fixed, 1078, errc{}, 0x1.0000000000001p-1022}, + + // above (1 + 2^-53) * 2^-1022: incremented last digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072016301" + "2305563795567615250361241457301801308322872404958664760675944619203679411688695321398552054903200090343478188" + "4412325572184367563347617020518175998922941393629966742598285899994830148971433555578567693279306015978183162" + "1424250679624607852958851992724935776883207324924799248168692322471659649343292587839501022509739575795105716" + "0073834364573849432419299709217920738991976169431413149717326525502008499797367678374315520581880443916381057" + "2367791175177756227497413804253387084478193655533073867420834526162513029462022730109054820067654020201547112" + "0020281397001415752591234401773622442737124681517501897455599786532342558862196115163359241679580296044770649" + "4647018477736093430045142168360701364747951396213837722826145437693412532098591327667236328126", + chars_format::fixed, 1077, errc{}, 0x1.0000000000001p-1022}, + + // just below (1 + 1 - 3 * 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "5398102212132212018470035807616260163568645811358486831521563686919762403704226016998291015624999", + chars_format::fixed, 1080, errc{}, 0x1.ffffffffffffep-1022}, + + // (1 + 1 - 3 * 2^-53) * 2^-1022 exactly + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "5398102212132212018470035807616260163568645811358486831521563686919762403704226016998291015625", + chars_format::fixed, 1077, errc{}, 0x1.ffffffffffffep-1022}, + + // (1 + 1 - 3 * 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "5398102212132212018470035807616260163568645811358486831521563686919762403704226016998291015625000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000", + chars_format::fixed, 2077, errc{}, 0x1.ffffffffffffep-1022}, + + // above (1 + 1 - 3 * 2^-53) * 2^-1022: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "5398102212132212018470035807616260163568645811358486831521563686919762403704226016998291015625000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00001", + chars_format::fixed, 2078, errc{}, 0x1.fffffffffffffp-1022}, + + // above (1 + 1 - 3 * 2^-53) * 2^-1022: appended a 1 digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "53981022121322120184700358076162601635686458113584868315215636869197624037042260169982910156251", + chars_format::fixed, 1078, errc{}, 0x1.fffffffffffffp-1022}, + + // above (1 + 1 - 3 * 2^-53) * 2^-1022: incremented last digit + {"0." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044501477170144020250" + "8199667279499186358524265859260511351695091228726223124931264069530541271189424317838013700808305231545782515" + "4530323827726959236845743044099361970891187471508150509418060480375117378320411851935338796416115205148741308" + "3163272520124606023105869053620631175265621765214646643181420505164043632222668006474326056011713528291579642" + "2274554896821334728738317548403413978098469341510556195293821919814730032341053661708792231510873354131880491" + "1055533902788485678121901775450062980622457102958163711745945687733011032421168917765671370549738710820782247" + "7584250967061891687062782163335299376138075114200886249979505279101870966346394401564490729731565935244123171" + "5398102212132212018470035807616260163568645811358486831521563686919762403704226016998291015626", + chars_format::fixed, 1077, errc{}, 0x1.fffffffffffffp-1022}, + + // just below (1 + 2^-53) * 2^-33: decremented last digit, then appended three 9 digits + {"0.00000000011641532182693482737782207114105741986576081359316958696581423282623291015624999", chars_format::fixed, + 91, errc{}, 0x1.0000000000000p-33}, + + // (1 + 2^-53) * 2^-33 exactly + {"0.00000000011641532182693482737782207114105741986576081359316958696581423282623291015625", chars_format::fixed, + 88, errc{}, 0x1.0000000000000p-33}, + + // (1 + 2^-53) * 2^-33 exactly, followed by a thousand 0 digits + {"0." + "0000000001164153218269348273778220711410574198657608135931695869658142328262329101562500000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1088, errc{}, 0x1.0000000000000p-33}, + + // above (1 + 2^-53) * 2^-33: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000001164153218269348273778220711410574198657608135931695869658142328262329101562500000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1089, errc{}, 0x1.0000000000001p-33}, + + // above (1 + 2^-53) * 2^-33: appended a 1 digit + {"0.000000000116415321826934827377822071141057419865760813593169586965814232826232910156251", chars_format::fixed, + 89, errc{}, 0x1.0000000000001p-33}, + + // above (1 + 2^-53) * 2^-33: incremented last digit + {"0.00000000011641532182693482737782207114105741986576081359316958696581423282623291015626", chars_format::fixed, + 88, errc{}, 0x1.0000000000001p-33}, + + // just below (1 + 1 - 3 * 2^-53) * 2^-33: decremented last digit, then appended three 9 digits + {"0.00000000023283064365386959013215878657682774040271755922049123910255730152130126953124999", chars_format::fixed, + 91, errc{}, 0x1.ffffffffffffep-33}, + + // (1 + 1 - 3 * 2^-53) * 2^-33 exactly + {"0.00000000023283064365386959013215878657682774040271755922049123910255730152130126953125", chars_format::fixed, + 88, errc{}, 0x1.ffffffffffffep-33}, + + // (1 + 1 - 3 * 2^-53) * 2^-33 exactly, followed by a thousand 0 digits + {"0." + "0000000002328306436538695901321587865768277404027175592204912391025573015213012695312500000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1088, errc{}, 0x1.ffffffffffffep-33}, + + // above (1 + 1 - 3 * 2^-53) * 2^-33: appended a thousand 0 digits followed by a 1 digit + {"0." + "0000000002328306436538695901321587865768277404027175592204912391025573015213012695312500000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1089, errc{}, 0x1.fffffffffffffp-33}, + + // above (1 + 1 - 3 * 2^-53) * 2^-33: appended a 1 digit + {"0.000000000232830643653869590132158786576827740402717559220491239102557301521301269531251", chars_format::fixed, + 89, errc{}, 0x1.fffffffffffffp-33}, + + // above (1 + 1 - 3 * 2^-53) * 2^-33: incremented last digit + {"0.00000000023283064365386959013215878657682774040271755922049123910255730152130126953126", chars_format::fixed, + 88, errc{}, 0x1.fffffffffffffp-33}, + + // just below (1 + 2^-53) * 2^0: decremented last digit, then appended three 9 digits + {"1.00000000000000011102230246251565404236316680908203124999", chars_format::fixed, 58, errc{}, + 0x1.0000000000000p+0}, + + // (1 + 2^-53) * 2^0 exactly + {"1.00000000000000011102230246251565404236316680908203125", chars_format::fixed, 55, errc{}, 0x1.0000000000000p+0}, + + // (1 + 2^-53) * 2^0 exactly, followed by a thousand 0 digits + {"1." + "0000000000000001110223024625156540423631668090820312500000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1055, errc{}, 0x1.0000000000000p+0}, + + // above (1 + 2^-53) * 2^0: appended a thousand 0 digits followed by a 1 digit + {"1." + "0000000000000001110223024625156540423631668090820312500000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1056, errc{}, 0x1.0000000000001p+0}, + + // above (1 + 2^-53) * 2^0: appended a 1 digit + {"1.000000000000000111022302462515654042363166809082031251", chars_format::fixed, 56, errc{}, 0x1.0000000000001p+0}, + + // above (1 + 2^-53) * 2^0: incremented last digit + {"1.00000000000000011102230246251565404236316680908203126", chars_format::fixed, 55, errc{}, 0x1.0000000000001p+0}, + + // just below (1 + 1 - 3 * 2^-53) * 2^0: decremented last digit, then appended three 9 digits + {"1.99999999999999966693309261245303787291049957275390624999", chars_format::fixed, 58, errc{}, + 0x1.ffffffffffffep+0}, + + // (1 + 1 - 3 * 2^-53) * 2^0 exactly + {"1.99999999999999966693309261245303787291049957275390625", chars_format::fixed, 55, errc{}, 0x1.ffffffffffffep+0}, + + // (1 + 1 - 3 * 2^-53) * 2^0 exactly, followed by a thousand 0 digits + {"1." + "9999999999999996669330926124530378729104995727539062500000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1055, errc{}, 0x1.ffffffffffffep+0}, + + // above (1 + 1 - 3 * 2^-53) * 2^0: appended a thousand 0 digits followed by a 1 digit + {"1." + "9999999999999996669330926124530378729104995727539062500000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1056, errc{}, 0x1.fffffffffffffp+0}, + + // above (1 + 1 - 3 * 2^-53) * 2^0: appended a 1 digit + {"1.999999999999999666933092612453037872910499572753906251", chars_format::fixed, 56, errc{}, 0x1.fffffffffffffp+0}, + + // above (1 + 1 - 3 * 2^-53) * 2^0: incremented last digit + {"1.99999999999999966693309261245303787291049957275390626", chars_format::fixed, 55, errc{}, 0x1.fffffffffffffp+0}, + + // just below (1 + 2^-53) * 2^33: decremented last digit, then appended three 9 digits + {"8589934592.00000095367431640624999", chars_format::fixed, 34, errc{}, 0x1.0000000000000p+33}, + + // (1 + 2^-53) * 2^33 exactly + {"8589934592.00000095367431640625", chars_format::fixed, 31, errc{}, 0x1.0000000000000p+33}, + + // (1 + 2^-53) * 2^33 exactly, followed by a thousand 0 digits + {"8589934592." + "0000009536743164062500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000", + chars_format::fixed, 1031, errc{}, 0x1.0000000000000p+33}, + + // above (1 + 2^-53) * 2^33: appended a thousand 0 digits followed by a 1 digit + {"8589934592." + "0000009536743164062500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000001", + chars_format::fixed, 1032, errc{}, 0x1.0000000000001p+33}, + + // above (1 + 2^-53) * 2^33: appended a 1 digit + {"8589934592.000000953674316406251", chars_format::fixed, 32, errc{}, 0x1.0000000000001p+33}, + + // above (1 + 2^-53) * 2^33: incremented last digit + {"8589934592.00000095367431640626", chars_format::fixed, 31, errc{}, 0x1.0000000000001p+33}, + + // just below (1 + 1 - 3 * 2^-53) * 2^33: decremented last digit, then appended three 9 digits + {"17179869183.99999713897705078124999", chars_format::fixed, 35, errc{}, 0x1.ffffffffffffep+33}, + + // (1 + 1 - 3 * 2^-53) * 2^33 exactly + {"17179869183.99999713897705078125", chars_format::fixed, 32, errc{}, 0x1.ffffffffffffep+33}, + + // (1 + 1 - 3 * 2^-53) * 2^33 exactly, followed by a thousand 0 digits + {"17179869183." + "9999971389770507812500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000", + chars_format::fixed, 1032, errc{}, 0x1.ffffffffffffep+33}, + + // above (1 + 1 - 3 * 2^-53) * 2^33: appended a thousand 0 digits followed by a 1 digit + {"17179869183." + "9999971389770507812500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000001", + chars_format::fixed, 1033, errc{}, 0x1.fffffffffffffp+33}, + + // above (1 + 1 - 3 * 2^-53) * 2^33: appended a 1 digit + {"17179869183.999997138977050781251", chars_format::fixed, 33, errc{}, 0x1.fffffffffffffp+33}, + + // above (1 + 1 - 3 * 2^-53) * 2^33: incremented last digit + {"17179869183.99999713897705078126", chars_format::fixed, 32, errc{}, 0x1.fffffffffffffp+33}, + + // just below (1 + 2^-53) * 2^77: decremented last digit, then appended three 9 digits + {"151115727451828663615487.999", chars_format::fixed, 28, errc{}, 0x1.0000000000000p+77}, + + // (1 + 2^-53) * 2^77 exactly + {"151115727451828663615488", chars_format::fixed, 24, errc{}, 0x1.0000000000000p+77}, + + // (1 + 2^-53) * 2^77 exactly, followed by a thousand 0 digits + {"151115727451828663615488." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000", + chars_format::fixed, 1025, errc{}, 0x1.0000000000000p+77}, + + // above (1 + 2^-53) * 2^77: appended a thousand 0 digits followed by a 1 digit + {"151115727451828663615488." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000001", + chars_format::fixed, 1026, errc{}, 0x1.0000000000001p+77}, + + // above (1 + 2^-53) * 2^77: appended a 1 digit + {"151115727451828663615488.1", chars_format::fixed, 26, errc{}, 0x1.0000000000001p+77}, + + // above (1 + 2^-53) * 2^77: incremented last digit + {"151115727451828663615489", chars_format::fixed, 24, errc{}, 0x1.0000000000001p+77}, + + // just below (1 + 1 - 3 * 2^-53) * 2^77: decremented last digit, then appended three 9 digits + {"302231454903657243344895.999", chars_format::fixed, 28, errc{}, 0x1.ffffffffffffep+77}, + + // (1 + 1 - 3 * 2^-53) * 2^77 exactly + {"302231454903657243344896", chars_format::fixed, 24, errc{}, 0x1.ffffffffffffep+77}, + + // (1 + 1 - 3 * 2^-53) * 2^77 exactly, followed by a thousand 0 digits + {"302231454903657243344896." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000", + chars_format::fixed, 1025, errc{}, 0x1.ffffffffffffep+77}, + + // above (1 + 1 - 3 * 2^-53) * 2^77: appended a thousand 0 digits followed by a 1 digit + {"302231454903657243344896." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000001", + chars_format::fixed, 1026, errc{}, 0x1.fffffffffffffp+77}, + + // above (1 + 1 - 3 * 2^-53) * 2^77: appended a 1 digit + {"302231454903657243344896.1", chars_format::fixed, 26, errc{}, 0x1.fffffffffffffp+77}, + + // above (1 + 1 - 3 * 2^-53) * 2^77: incremented last digit + {"302231454903657243344897", chars_format::fixed, 24, errc{}, 0x1.fffffffffffffp+77}, + + // just below (1 + 2^-53) * 2^1023: decremented last digit, then appended three 9 digits + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708031.999", + chars_format::fixed, 312, errc{}, 0x1.0000000000000p+1023}, + + // (1 + 2^-53) * 2^1023 exactly + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708032", + chars_format::fixed, 308, errc{}, 0x1.0000000000000p+1023}, + + // (1 + 2^-53) * 2^1023 exactly, followed by a thousand 0 digits + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708032." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000", + chars_format::fixed, 1309, errc{}, 0x1.0000000000000p+1023}, + + // above (1 + 2^-53) * 2^1023: appended a thousand 0 digits followed by a 1 digit + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708032." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000001", + chars_format::fixed, 1310, errc{}, 0x1.0000000000001p+1023}, + + // above (1 + 2^-53) * 2^1023: appended a 1 digit + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708032.1", + chars_format::fixed, 310, errc{}, 0x1.0000000000001p+1023}, + + // above (1 + 2^-53) * 2^1023: incremented last digit + {"8988465674311580536566680721305029496276241413130815897397134275615404541548669375241369800602409693534988440" + "3114202125541629105369684531108613657287705365884742938136589844238179474556051429647415148697857438797685859" + "063890851407391008830874765563025951597582513936655578157348020066364210154316532161708033", + chars_format::fixed, 308, errc{}, 0x1.0000000000001p+1023}, + + // just below (1 + 1 - 3 * 2^-53) * 2^1023: decremented last digit, then appended three 9 digits + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218943.999", + chars_format::fixed, 313, errc{}, 0x1.ffffffffffffep+1023}, + + // (1 + 1 - 3 * 2^-53) * 2^1023 exactly + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218944", + chars_format::fixed, 309, errc{}, 0x1.ffffffffffffep+1023}, + + // (1 + 1 - 3 * 2^-53) * 2^1023 exactly, followed by a thousand 0 digits + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218944." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000", + chars_format::fixed, 1310, errc{}, 0x1.ffffffffffffep+1023}, + + // above (1 + 1 - 3 * 2^-53) * 2^1023: appended a thousand 0 digits followed by a 1 digit + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218944." + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000001", + chars_format::fixed, 1311, errc{}, 0x1.fffffffffffffp+1023}, + + // above (1 + 1 - 3 * 2^-53) * 2^1023: appended a 1 digit + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218944.1", + chars_format::fixed, 311, errc{}, 0x1.fffffffffffffp+1023}, + + // above (1 + 1 - 3 * 2^-53) * 2^1023: incremented last digit + {"1797693134862315608353258760581052985162070023416521662616611746258695532672923265745300992879465492467506314" + "9033587701752208710592698796290627760473556921329019091915239418047621712533496094635638726128664019802903779" + "9514183602981511756283727771403830521483963923935633133642802139091669457927874464075218945", + chars_format::fixed, 309, errc{}, 0x1.fffffffffffffp+1023}, + + // VSO-852024 also affected hexfloats. + {"0.00000000000008p-1022", chars_format::hex, 22, errc::result_out_of_range, 0x0.0000000000000p+0}, + {"0." + "0000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p-1022", + chars_format::hex, 1023, errc{}, 0x0.0000000000001p-1022}, + + {"0.ffffffffffffe8p-1022", chars_format::hex, 22, errc{}, 0x0.ffffffffffffep-1022}, + {"0." + "ffffffffffffe800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p-1022", + chars_format::hex, 1023, errc{}, 0x0.fffffffffffffp-1022}, + + {"1.00000000000008p+0", chars_format::hex, 19, errc{}, 0x1.0000000000000p+0}, + {"1." + "0000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p+0", + chars_format::hex, 1020, errc{}, 0x1.0000000000001p+0}, + + {"1.ffffffffffffe8p+0", chars_format::hex, 19, errc{}, 0x1.ffffffffffffep+0}, + {"1." + "ffffffffffffe800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p+0", + chars_format::hex, 1020, errc{}, 0x1.fffffffffffffp+0}, + + {"1.00000000000008p+1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p+1023}, + {"1." + "0000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p+1023", + chars_format::hex, 1023, errc{}, 0x1.0000000000001p+1023}, + + {"1.ffffffffffffe8p+1023", chars_format::hex, 22, errc{}, 0x1.ffffffffffffep+1023}, + {"1." + "ffffffffffffe800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000001p+1023", + chars_format::hex, 1023, errc{}, 0x1.fffffffffffffp+1023}, + + // VSO-733765 ": [Feedback] double std::from_chars behavior on exponent out of range" + // LWG-3081 "Floating point from_chars API does not distinguish between overflow and underflow" + // These test cases exercise every overflow/underflow codepath. + {"1e+1000", chars_format::scientific, 7, errc::result_out_of_range, double_inf}, + {"1e-1000", chars_format::scientific, 7, errc::result_out_of_range, 0.0}, + {"1.fffffffffffff8p+1023", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"1e+2000", chars_format::scientific, 7, errc::result_out_of_range, double_inf}, + {"1e-2000", chars_format::scientific, 7, errc::result_out_of_range, 0.0}, + {"1e+9999", chars_format::scientific, 7, errc::result_out_of_range, double_inf}, + {"1e-9999", chars_format::scientific, 7, errc::result_out_of_range, 0.0}, + {"10e+5199", chars_format::scientific, 8, errc::result_out_of_range, double_inf}, + {"0.001e-5199", chars_format::scientific, 11, errc::result_out_of_range, 0.0}, + + // GH-931 ": hex from_chars(\"0.fffffffffffff8p-1022\") is incorrect" + // Test cases for values close to std::numeric_limits::min() and std::numeric_limits::max() + {"0.fffffffffffffp-1022", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"1.0000000000000p-1022", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + + {"1.ffffffffffffep-1023", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"1.fffffffffffffp-1023", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"2.0000000000000p-1023", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + + {"3.ffffffffffffcp-1024", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"3.ffffffffffffdp-1024", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"3.ffffffffffffep-1024", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"3.fffffffffffffp-1024", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"4.0000000000000p-1024", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + + {"7.ffffffffffff8p-1025", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffff9p-1025", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffffbp-1025", chars_format::hex, 21, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffffcp-1025", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffdp-1025", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffep-1025", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"7.fffffffffffffp-1025", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + {"8.0000000000000p-1025", chars_format::hex, 21, errc{}, 0x1.0000000000000p-1022}, + + {"0.fffffffffffff0p-1022", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"0.fffffffffffff1p-1022", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"0.fffffffffffff7p-1022", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"0.fffffffffffff8p-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"0.fffffffffffff9p-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"0.fffffffffffffbp-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"0.fffffffffffffcp-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"0.fffffffffffffdp-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"0.ffffffffffffffp-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.00000000000000p-1022", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + + {"1.ffffffffffffe0p-1023", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"1.ffffffffffffe1p-1023", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"1.ffffffffffffefp-1023", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"1.fffffffffffff0p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.fffffffffffff1p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.fffffffffffff7p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.fffffffffffff8p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.fffffffffffff9p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"1.ffffffffffffffp-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"2.00000000000000p-1023", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + + {"3.ffffffffffffc0p-1024", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"3.ffffffffffffc1p-1024", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"3.ffffffffffffdfp-1024", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"3.ffffffffffffe0p-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"3.ffffffffffffe1p-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"3.ffffffffffffefp-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"3.fffffffffffff0p-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"3.fffffffffffff1p-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"3.ffffffffffffffp-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"4.00000000000000p-1024", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + + {"7.ffffffffffff80p-1025", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffff81p-1025", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffffbfp-1025", chars_format::hex, 22, errc{}, 0x0.fffffffffffffp-1022}, + {"7.ffffffffffffc0p-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffc1p-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffdfp-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffe0p-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffe1p-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"7.ffffffffffffffp-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + {"8.00000000000000p-1025", chars_format::hex, 22, errc{}, 0x1.0000000000000p-1022}, + + {"1.fffffffffffffp+1023", chars_format::hex, 21, errc{}, 0x1.fffffffffffffp+1023}, + {"2.0000000000000p+1023", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + + {"3.ffffffffffffep+1022", chars_format::hex, 21, errc{}, 0x1.fffffffffffffp+1023}, + {"3.fffffffffffffp+1022", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + {"4.0000000000000p+1022", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + + {"7.ffffffffffffcp+1021", chars_format::hex, 21, errc{}, 0x1.fffffffffffffp+1023}, + {"7.ffffffffffffdp+1021", chars_format::hex, 21, errc{}, 0x1.fffffffffffffp+1023}, + {"7.ffffffffffffep+1021", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + {"7.fffffffffffffp+1021", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + {"8.0000000000000p+1021", chars_format::hex, 21, errc::result_out_of_range, double_inf}, + + {"0.fffffffffffff8p+1024", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffff9p+1024", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffffbp+1024", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffffcp+1024", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"0.fffffffffffffdp+1024", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"0.ffffffffffffffp+1024", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"1.00000000000000p+1024", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + + {"1.fffffffffffff0p+1023", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"1.fffffffffffff1p+1023", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"1.fffffffffffff7p+1023", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"1.fffffffffffff8p+1023", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"1.fffffffffffff9p+1023", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"1.ffffffffffffffp+1023", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"2.00000000000000p+1023", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + + {"3.ffffffffffffe0p+1022", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"3.ffffffffffffe1p+1022", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"3.ffffffffffffefp+1022", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"3.fffffffffffff0p+1022", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"3.fffffffffffff1p+1022", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"3.ffffffffffffffp+1022", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"4.00000000000000p+1022", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + + {"7.ffffffffffffc0p+1021", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"7.ffffffffffffc1p+1021", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"7.ffffffffffffdfp+1021", chars_format::hex, 22, errc{}, 0x1.fffffffffffffp+1023}, + {"7.ffffffffffffe0p+1021", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"7.ffffffffffffe1p+1021", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"7.ffffffffffffffp+1021", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + {"8.00000000000000p+1021", chars_format::hex, 22, errc::result_out_of_range, double_inf}, + + {"0.fffffffffffff80p+1024", chars_format::hex, 23, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffff81p+1024", chars_format::hex, 23, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffffbfp+1024", chars_format::hex, 23, errc{}, 0x1.fffffffffffffp+1023}, + {"0.fffffffffffffc0p+1024", chars_format::hex, 23, errc::result_out_of_range, double_inf}, + {"0.fffffffffffffc1p+1024", chars_format::hex, 23, errc::result_out_of_range, double_inf}, + {"0.fffffffffffffffp+1024", chars_format::hex, 23, errc::result_out_of_range, double_inf}, + {"1.000000000000000p+1024", chars_format::hex, 23, errc::result_out_of_range, double_inf}, + + // (0 + 1 - 2 * 2^-53) * 2^-1022 exactly + {"2." + "22507385850720088902458687608585988765042311224095946549352480256244000922823569517877588880375915526423097809504" + "34312085877387158357291821993020294379224223559819827501242041788969571311791082261043971979604000454897391938079" + "19893608152561311337614984204327175103362739154978273159414382813627511383860409424946494228631669542910508020181" + "59266421349966065178030950759130587198464239060686371020051087232827846788436319445158661350412234790147923695852" + "08321597621066375401613736583044193603714778355306682834535634005074073040135602968046375918583163124224521599262" + "54649430083685186171942241764645513713542013221703137049658321015465406803539741790602258950302350193751977303094" + "5763173210852507299305089761582519159720757232455434770912461317493580281734466552734375e-308", + chars_format::scientific, 773, errc{}, 0x0.fffffffffffffp-1022}, + + // (0 + 1 - 2 * 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"2." + "22507385850720088902458687608585988765042311224095946549352480256244000922823569517877588880375915526423097809504" + "34312085877387158357291821993020294379224223559819827501242041788969571311791082261043971979604000454897391938079" + "19893608152561311337614984204327175103362739154978273159414382813627511383860409424946494228631669542910508020181" + "59266421349966065178030950759130587198464239060686371020051087232827846788436319445158661350412234790147923695852" + "08321597621066375401613736583044193603714778355306682834535634005074073040135602968046375918583163124224521599262" + "54649430083685186171942241764645513713542013221703137049658321015465406803539741790602258950302350193751977303094" + "57631732108525072993050897615825191597207572324554347709124613174935802817344665527343750000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000e-308", + chars_format::scientific, 1773, errc{}, 0x0.fffffffffffffp-1022}, + + // above (0 + 1 - 2 * 2^-53) * 2^-1022, appended a thousand 0 digits followed by a 1 digit + {"2." + "22507385850720088902458687608585988765042311224095946549352480256244000922823569517877588880375915526423097809504" + "34312085877387158357291821993020294379224223559819827501242041788969571311791082261043971979604000454897391938079" + "19893608152561311337614984204327175103362739154978273159414382813627511383860409424946494228631669542910508020181" + "59266421349966065178030950759130587198464239060686371020051087232827846788436319445158661350412234790147923695852" + "08321597621066375401613736583044193603714778355306682834535634005074073040135602968046375918583163124224521599262" + "54649430083685186171942241764645513713542013221703137049658321015465406803539741790602258950302350193751977303094" + "57631732108525072993050897615825191597207572324554347709124613174935802817344665527343750000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000001e-308", + chars_format::scientific, 1774, errc{}, 0x0.fffffffffffffp-1022}, + + // above (0 + 1 - 2 * 2^-53) * 2^-1022: appended a 1 digit + {"2." + "22507385850720088902458687608585988765042311224095946549352480256244000922823569517877588880375915526423097809504" + "34312085877387158357291821993020294379224223559819827501242041788969571311791082261043971979604000454897391938079" + "19893608152561311337614984204327175103362739154978273159414382813627511383860409424946494228631669542910508020181" + "59266421349966065178030950759130587198464239060686371020051087232827846788436319445158661350412234790147923695852" + "08321597621066375401613736583044193603714778355306682834535634005074073040135602968046375918583163124224521599262" + "54649430083685186171942241764645513713542013221703137049658321015465406803539741790602258950302350193751977303094" + "57631732108525072993050897615825191597207572324554347709124613174935802817344665527343751e-308", + chars_format::scientific, 774, errc{}, 0x0.fffffffffffffp-1022}, + + // above (0 + 1 - 2 * 2^-53) * 2^-1022: incremented last digit + {"2." + "22507385850720088902458687608585988765042311224095946549352480256244000922823569517877588880375915526423097809504" + "34312085877387158357291821993020294379224223559819827501242041788969571311791082261043971979604000454897391938079" + "19893608152561311337614984204327175103362739154978273159414382813627511383860409424946494228631669542910508020181" + "59266421349966065178030950759130587198464239060686371020051087232827846788436319445158661350412234790147923695852" + "08321597621066375401613736583044193603714778355306682834535634005074073040135602968046375918583163124224521599262" + "54649430083685186171942241764645513713542013221703137049658321015465406803539741790602258950302350193751977303094" + "5763173210852507299305089761582519159720757232455434770912461317493580281734466552734376e-308", + chars_format::scientific, 773, errc{}, 0x0.fffffffffffffp-1022}, + + // below (0 + 1 - 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "44580400103493397042756718644338377048603786162277173854562306587467901408672332763671874999e-308", + chars_format::scientific, 777, errc{}, 0x0.fffffffffffffp-1022}, + + // (0 + 1 - 2^-53) * 2^-1022 exactly + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "44580400103493397042756718644338377048603786162277173854562306587467901408672332763671875e-308", + chars_format::scientific, 774, errc{}, 0x1.0000000000000p-1022}, + + // (0 + 1 - 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "44580400103493397042756718644338377048603786162277173854562306587467901408672332763671875000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000e-308", + chars_format::scientific, 1774, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 2^-53) * 2^-1022: append a thousand 0 digits followed by a 1 digit + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "44580400103493397042756718644338377048603786162277173854562306587467901408672332763671875000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000001e-308", + chars_format::scientific, 1775, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 2^-53) * 2^-1022: appended a 1 digit + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "445804001034933970427567186443383770486037861622771738545623065874679014086723327636718751e-308", + chars_format::scientific, 775, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 2^-53) * 2^-1022: incremented last digit + {"2." + "22507385850720113605740979670913197593481954635164564802342610972482222202107694551652952390813508791414915891303" + "96211068700864386945946455276572074078206217433799881410632673292535522868813721490129811224514518898490572223072" + "85255133155755015914397476397983411801999323962548289017107081850690630666655994938275772572015763062690663332647" + "56530000924588831643303777979186961204949739037782970490505108060994073026293712895895000358379996720725430436028" + "40788957717961509455167482434710307026091446215722898802581825451803257070188608721131280795122334262883686223215" + "03775666622503982534335974568884423900265498198385487948292206894721689831099698365846814022854243330660339850886" + "44580400103493397042756718644338377048603786162277173854562306587467901408672332763671876e-308", + chars_format::scientific, 774, errc{}, 0x1.0000000000000p-1022}, + + // below (0 + 1 - 0.5 * 2^-53) * 2^-1022: decremented last digit, then appended three 9 digits + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "380547341009775590676096291585949697743018930811385869272811532937339507043361663818359374999e-308", + chars_format::scientific, 778, errc{}, 0x1.0000000000000p-1022}, + + // (0 + 1 - 0.5 * 2^-53) * 2^-1022 exactly + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "380547341009775590676096291585949697743018930811385869272811532937339507043361663818359375e-308", + chars_format::scientific, 775, errc{}, 0x1.0000000000000p-1022}, + + // (0 + 1 - 0.5 * 2^-53) * 2^-1022 exactly, followed by a thousand 0 digits + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "38054734100977559067609629158594969774301893081138586927281153293733950704336166381835937500000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000e-308", + chars_format::scientific, 1775, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 0.5 * 2^-53) * 2^-1022: append a thousand 0 digits followed by a 1 digit + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "38054734100977559067609629158594969774301893081138586927281153293733950704336166381835937500000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000001e-308", + chars_format::scientific, 1776, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 0.5 * 2^-53) * 2^-1022: appended a 1 digit + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "3805473410097755906760962915859496977430189308113858692728115329373395070433616638183593751e-308", + chars_format::scientific, 776, errc{}, 0x1.0000000000000p-1022}, + + // above (0 + 1 - 0.5 * 2^-53) * 2^-1022: incremented last digit + {"2." + "22507385850720125957382125702076802007701776340698873928837676330601332841749757068540634146032305423910824932203" + "77160560112603001240273771918347963927697214370789908365327989044318498647325041104672730846969778120287162365569" + "67935895657351868202788722494811530151317616366333296945953431369222190308053787694940411743707809822580740988880" + "55161790711900214875940191589215148208192489026331270225732118475077186145222409621263169862363877686014183806116" + "57022637766409076481944355360543363737279780145931006786604921175167849085215111597673733233391919832213268535191" + "28338784891913380715532840971003878993627240686726663397609149834349831344879676653469091559130189899114521124782" + "380547341009775590676096291585949697743018930811385869272811532937339507043361663818359376e-308", + chars_format::scientific, 775, errc{}, 0x1.0000000000000p-1022}, + + // below 1 * 2^-1022: decremented last digit, then appended three 9 digits + {"2." + "22507385850720138309023271733240406421921598046233183055332741688720443481391819585428315901251102056406733973103" + "58110051524341615534601088560123853777188211307779935320023304796101474425836360719215650469425037342083752508066" + "50616658158948720491179968591639648500635908770118304874799780887753749949451580451605050915399856582470818645113" + "53793580499211598108576605199243335211435239014879569960959128889160299264151106346631339366347758651302937176204" + "73256317814856643508721228286376420448468114076139114770628016898532441100241614474216185671661505401542850847167" + "52901903161322778896729707373123334086988983175067838846926092773977972858659654941091369095406136467568702398678" + "315290680984617210924625396728515624999e-308", + chars_format::scientific, 724, errc{}, 0x1.0000000000000p-1022}, + + // 1 * 2^-1022 exactly + {"2." + "22507385850720138309023271733240406421921598046233183055332741688720443481391819585428315901251102056406733973103" + "58110051524341615534601088560123853777188211307779935320023304796101474425836360719215650469425037342083752508066" + "50616658158948720491179968591639648500635908770118304874799780887753749949451580451605050915399856582470818645113" + "53793580499211598108576605199243335211435239014879569960959128889160299264151106346631339366347758651302937176204" + "73256317814856643508721228286376420448468114076139114770628016898532441100241614474216185671661505401542850847167" + "52901903161322778896729707373123334086988983175067838846926092773977972858659654941091369095406136467568702398678" + "315290680984617210924625396728515625e-308", + chars_format::scientific, 721, errc{}, 0x1.0000000000000p-1022}, + + // (1 + 1 - 2 * 2^-53) * 2^1023 exactly + {"17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351" + "43824642343213268894641827684675467035375169860499105765512820762454900903893289440758685084551339423045832369032" + "22948165808559332123348274797826204144723168738177180919299881250404026184124858368", + chars_format::fixed, 309, errc{}, 0x1.fffffffffffffp+1023}, + + // (1 + 1 - 2 * 2^-53) * 2^1023 exactly, followed by a thousand 0 digits + {"17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351" + "43824642343213268894641827684675467035375169860499105765512820762454900903893289440758685084551339423045832369032" + "22948165808559332123348274797826204144723168738177180919299881250404026184124858368." + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1310, errc{}, 0x1.fffffffffffffp+1023}, + + // above (1 + 1 - 2 * 2^-53) * 2^1023, appended a thousand 0 digits followed by a 1 digit + {"17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351" + "43824642343213268894641827684675467035375169860499105765512820762454900903893289440758685084551339423045832369032" + "22948165808559332123348274797826204144723168738177180919299881250404026184124858368." + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1311, errc{}, 0x1.fffffffffffffp+1023}, + + // above (1 + 1 - 2 * 2^-53) * 2^1023: appended a 1 digit + {"17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351" + "43824642343213268894641827684675467035375169860499105765512820762454900903893289440758685084551339423045832369032" + "22948165808559332123348274797826204144723168738177180919299881250404026184124858368.1", + chars_format::fixed, 311, errc{}, 0x1.fffffffffffffp+1023}, + + // above (1 + 1 - 2 * 2^-53) * 2^1023: incremented last digit + {"17976931348623157081452742373170435679807056752584499659891747680315726078002853876058955863276687817154045895351" + "43824642343213268894641827684675467035375169860499105765512820762454900903893289440758685084551339423045832369032" + "22948165808559332123348274797826204144723168738177180919299881250404026184124858369", + chars_format::fixed, 309, errc{}, 0x1.fffffffffffffp+1023}, + + // below (1 + 1 - 2^-53) * 2^1023: decremented last digit, then appended three 9 digits + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497791.999", + chars_format::fixed, 313, errc{}, 0x1.fffffffffffffp+1023}, + + // (1 + 1 - 2^-53) * 2^1023 exactly + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497792", + chars_format::fixed, 309, errc::result_out_of_range, double_inf}, + + // (1 + 1 - 2^-53) * 2^1023 exactly, followed by a thousand 0 digits + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497792." + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + chars_format::fixed, 1310, errc::result_out_of_range, double_inf}, + + // above (1 + 1 - 2^-53) * 2^1023: append a thousand 0 digits followed by a 1 digit + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497792." + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + chars_format::fixed, 1311, errc::result_out_of_range, double_inf}, + + // above (1 + 1 - 2^-53) * 2^1023: appended a 1 digit + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497792.1", + chars_format::fixed, 311, errc::result_out_of_range, double_inf}, + + // above (1 + 1 - 2^-53) * 2^1023: incremented last digit + {"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669" + "28879109465555478519404026306574886715058206819089020007083836762738548458177115317644757302700698555713669596228" + "42914819860834936475292719074168444365510704342711559699508093042880177904174497792", + chars_format::fixed, 309, errc::result_out_of_range, double_inf}, + + // below 1 * 2^1024: decremented last digit, then appended three 9 digits + {"17976931348623159077293051907890247336179769789423065727343008115773267580550096313270847732240753602112011387987" + "13933576587897688144166224928474306394741243777678934248654852763022196012460941194530829520850057688381506823424" + "62881473913110540827237163350510684586298239947245938479716304835356329624224137215.999", + chars_format::fixed, 313, errc::result_out_of_range, double_inf}, + + // 1 * 2^1024 exactly + {"17976931348623159077293051907890247336179769789423065727343008115773267580550096313270847732240753602112011387987" + "13933576587897688144166224928474306394741243777678934248654852763022196012460941194530829520850057688381506823424" + "62881473913110540827237163350510684586298239947245938479716304835356329624224137216", + chars_format::fixed, 309, errc::result_out_of_range, double_inf}, +}; + +int +main() +{ + for (const auto [input,fmt,correct_end,correct_ec,correct_value] + : double_from_chars_test_cases) + { + if (fmt == chars_format::hex) + // FIXME: Due to quirks in some strtod implementations, the hex + // testcases are currently disabled until we implement hex parsing in a + // more portable way that doesn't go through the target libc's strtod. + continue; + + double value = -1.2345; + const auto [ptr,ec] = from_chars(input, input + strlen(input), value, fmt); + VERIFY( correct_ec == ec ); + VERIFY( ptr == input + correct_end ); + if (ec == errc{}) + VERIFY( value == correct_value ); + else + VERIFY( value == -1.2345 ); + } +} diff --git a/libstdc++-v3/testsuite/20_util/from_chars/float.cc b/libstdc++-v3/testsuite/20_util/from_chars/float.cc new file mode 100644 index 00000000000..ba39b7e16a1 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/from_chars/float.cc @@ -0,0 +1,296 @@ +// This file consists of testcases extracted from the MSVC STL testsuite. + +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +// { dg-do run { target c++17 } } +// { dg-require-effective-target ieee-floats } + +#include + +#include +#include +#include + +using namespace std; + +inline constexpr float float_inf = numeric_limits::infinity(); + +struct float_to_chars_testcase { + const char* input; + chars_format fmt; + size_t correct_idx; + errc correct_ec; + float correct_value; +}; + +inline constexpr float_to_chars_testcase float_from_chars_test_cases[] = { + {"1.a0000400", chars_format::hex, 10, errc{}, 0x1.a00004p0f}, // exact + {"1.a0000401", chars_format::hex, 10, errc{}, 0x1.a00004p0f}, // below midpoint, round down + {"1.a0000500", chars_format::hex, 10, errc{}, 0x1.a00004p0f}, // midpoint, round down to even + {"1.a0000501", chars_format::hex, 10, errc{}, 0x1.a00006p0f}, // above midpoint, round up + {"1.a0000600", chars_format::hex, 10, errc{}, 0x1.a00006p0f}, // exact + {"1.a0000601", chars_format::hex, 10, errc{}, 0x1.a00006p0f}, // below midpoint, round down + {"1.a0000700", chars_format::hex, 10, errc{}, 0x1.a00008p0f}, // midpoint, round up to even + {"1.a0000701", chars_format::hex, 10, errc{}, 0x1.a00008p0f}, // above midpoint, round up + + {"1.0000040", chars_format::hex, 9, errc{}, 0x1.000004p0f}, // exact + {"1.0000041", chars_format::hex, 9, errc{}, 0x1.000004p0f}, // below midpoint, round down + {"1.0000050", chars_format::hex, 9, errc{}, 0x1.000004p0f}, // midpoint, round down to even + {"1.0000051", chars_format::hex, 9, errc{}, 0x1.000006p0f}, // above midpoint, round up + {"1.0000060", chars_format::hex, 9, errc{}, 0x1.000006p0f}, // exact + {"1.0000061", chars_format::hex, 9, errc{}, 0x1.000006p0f}, // below midpoint, round down + {"1.0000070", chars_format::hex, 9, errc{}, 0x1.000008p0f}, // midpoint, round up to even + {"1.0000071", chars_format::hex, 9, errc{}, 0x1.000008p0f}, // above midpoint, round up + + {"1.0000002384185791015625000000", chars_format::general, 30, errc{}, 0x1.000004p0f}, // exact + {"1.0000002421438694000244140625", chars_format::general, 30, errc{}, 0x1.000004p0f}, // below midpoint, round down + {"1.0000002980232238769531249999", chars_format::general, 30, errc{}, 0x1.000004p0f}, // below midpoint, round down + {"1.0000002980232238769531250000", chars_format::general, 30, errc{}, + 0x1.000004p0f}, // midpoint, round down to even + {"1.0000002980232238769531250001", chars_format::general, 30, errc{}, 0x1.000006p0f}, // above midpoint, round up + {"1.0000003017485141754150390625", chars_format::general, 30, errc{}, 0x1.000006p0f}, // above midpoint, round up + {"1.0000003576278686523437500000", chars_format::general, 30, errc{}, 0x1.000006p0f}, // exact + {"1.0000003613531589508056640625", chars_format::general, 30, errc{}, 0x1.000006p0f}, // below midpoint, round down + {"1.0000004172325134277343749999", chars_format::general, 30, errc{}, 0x1.000006p0f}, // below midpoint, round down + {"1.0000004172325134277343750000", chars_format::general, 30, errc{}, 0x1.000008p0f}, // midpoint, round up to even + {"1.0000004172325134277343750001", chars_format::general, 30, errc{}, 0x1.000008p0f}, // above midpoint, round up + {"1.0000004209578037261962890625", chars_format::general, 30, errc{}, 0x1.000008p0f}, // above midpoint, round up + + // VSO-838635 ": from_chars() mishandles certain subnormals" + // This bug didn't actually affect float, but we should have similar test cases. + // These values change on half-ulp boundaries: + // 1 * 2^-150 ~= 7.01e-46 (half-ulp between zero and min subnormal) + // 2 * 2^-150 ~= 1.40e-45 (min subnormal) + // 3 * 2^-150 ~= 2.10e-45 (half-ulp between min subnormal and next subnormal) + // 4 * 2^-150 ~= 2.80e-45 (next subnormal) + {"6." + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666" + "6666666666666666666e-46", + chars_format::scientific, 1006, errc::result_out_of_range, 0x0.000000p+0f}, + {"7." + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777" + "7777777777777777777e-46", + chars_format::scientific, 1006, errc{}, 0x0.000002p-126f}, + {"8." + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888" + "8888888888888888888e-46", + chars_format::scientific, 1006, errc{}, 0x0.000002p-126f}, + {"9." + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" + "9999999999999999999e-46", + chars_format::scientific, 1006, errc{}, 0x0.000002p-126f}, + {"1." + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111" + "1111111111111111111e-45", + chars_format::scientific, 1006, errc{}, 0x0.000002p-126f}, + {"2." + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222" + "2222222222222222222e-45", + chars_format::scientific, 1006, errc{}, 0x0.000004p-126f}, + + // VSO-733765 ": [Feedback] double std::from_chars behavior on exponent out of range" + // LWG-3081 "Floating point from_chars API does not distinguish between overflow and underflow" + // These test cases exercise every overflow/underflow codepath. + {"1e+1000", chars_format::scientific, 7, errc::result_out_of_range, float_inf}, + {"1e-1000", chars_format::scientific, 7, errc::result_out_of_range, 0.0f}, + {"1.ffffffp+127", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"1e+2000", chars_format::scientific, 7, errc::result_out_of_range, float_inf}, + {"1e-2000", chars_format::scientific, 7, errc::result_out_of_range, 0.0f}, + {"1e+9999", chars_format::scientific, 7, errc::result_out_of_range, float_inf}, + {"1e-9999", chars_format::scientific, 7, errc::result_out_of_range, 0.0f}, + {"10e+5199", chars_format::scientific, 8, errc::result_out_of_range, float_inf}, + {"0.001e-5199", chars_format::scientific, 11, errc::result_out_of_range, 0.0f}, + + // GH-931 ": hex from_chars(\"0.fffffffffffff8p-1022\") is incorrect" + // Test cases for values close to std::numeric_limits::min() and std::numeric_limits::max() + {"7.fffffp-129", chars_format::hex, 12, errc{}, 0x0.fffffep-126f}, + {"8.00000p-129", chars_format::hex, 12, errc{}, 0x1.000000p-126f}, + + {"0.fffffep-126", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"0.ffffffp-126", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"1.000000p-126", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + + {"1.fffffcp-127", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"1.fffffdp-127", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"1.fffffep-127", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"1.ffffffp-127", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"2.000000p-127", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + + {"3.fffff8p-128", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"3.fffff9p-128", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"3.fffffbp-128", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"3.fffffcp-128", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"3.fffffdp-128", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"3.fffffep-128", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"3.ffffffp-128", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"4.000000p-128", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + + {"7.fffff0p-129", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"7.fffff1p-129", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"7.fffff7p-129", chars_format::hex, 13, errc{}, 0x0.fffffep-126f}, + {"7.fffff8p-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"7.fffff9p-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"7.fffffbp-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"7.fffffcp-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"7.fffffdp-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"7.ffffffp-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + {"8.000000p-129", chars_format::hex, 13, errc{}, 0x1.000000p-126f}, + + {"0.fffffe0p-126", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"0.fffffe1p-126", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"0.fffffefp-126", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"0.ffffff0p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"0.ffffff1p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"0.ffffff7p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"0.ffffff8p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"0.ffffff9p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"0.fffffffp-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.0000000p-126", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + + {"1.fffffc0p-127", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"1.fffffc1p-127", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"1.fffffdfp-127", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"1.fffffe0p-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.fffffe1p-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.fffffefp-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.ffffff0p-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.ffffff1p-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"1.fffffffp-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"2.0000000p-127", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + + {"3.fffff80p-128", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"3.fffff81p-128", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"3.fffffbfp-128", chars_format::hex, 14, errc{}, 0x0.fffffep-126f}, + {"3.fffffc0p-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"3.fffffc1p-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"3.fffffdfp-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"3.fffffe0p-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"3.fffffe1p-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"3.fffffffp-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + {"4.0000000p-128", chars_format::hex, 14, errc{}, 0x1.000000p-126f}, + + {"0.ffffffp+128", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"1.000000p+128", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + + {"1.fffffep+127", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"1.ffffffp+127", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"2.000000p+127", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + + {"3.fffffcp+126", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"3.fffffdp+126", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"3.fffffep+126", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"3.ffffffp+126", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"4.000000p+126", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + + {"7.fffff8p+125", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"7.fffff9p+125", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"7.fffffbp+125", chars_format::hex, 13, errc{}, 0x1.fffffep+127f}, + {"7.fffffcp+125", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"7.fffffdp+125", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"7.ffffffp+125", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + {"8.000000p+125", chars_format::hex, 13, errc::result_out_of_range, float_inf}, + + {"0.ffffff0p+128", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"0.ffffff1p+128", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"0.ffffff7p+128", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"0.ffffff8p+128", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"0.ffffff9p+128", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"0.fffffffp+128", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"1.0000000p+128", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + + {"1.fffffe0p+127", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"1.fffffe1p+127", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"1.fffffefp+127", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"1.ffffff0p+127", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"1.ffffff1p+127", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"1.fffffffp+127", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"2.0000000p+127", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + + {"3.fffffc0p+126", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"3.fffffc1p+126", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"3.fffffdfp+126", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"3.fffffe0p+126", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"3.fffffe1p+126", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"3.fffffffp+126", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"4.0000000p+126", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + + {"7.fffff80p+125", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"7.fffff81p+125", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"7.fffffbfp+125", chars_format::hex, 14, errc{}, 0x1.fffffep+127f}, + {"7.fffffc0p+125", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"7.fffffc1p+125", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"7.fffffffp+125", chars_format::hex, 14, errc::result_out_of_range, float_inf}, + {"8.0000000p+125", chars_format::hex, 14, errc::result_out_of_range, float_inf}, +}; + +int +main() +{ + for (const auto [input,fmt,correct_end,correct_ec,correct_value] + : float_from_chars_test_cases) + { + if (fmt == chars_format::hex) + // FIXME: Due to quirks in some strtod implementations, the hex + // testcases are currently disabled until we implement hex parsing in a + // more portable way that doesn't go through the target libc's strtod. + continue; + + float value = -1.2345f; + const auto [ptr,ec] = from_chars(input, input + strlen(input), value, fmt); + VERIFY( correct_ec == ec ); + VERIFY( ptr == input + correct_end ); + if (ec == errc{}) + VERIFY( value == correct_value ); + else + VERIFY( value == -1.2345f ); + } +} -- 2.34.0