C:\Users\Untelo\sandbox
λ cat test.cpp
#include <format>
#include <cassert>
using namespace std;
int main()
{
char buffer[2048];
auto r = to_chars(buffer, buffer + sizeof(buffer), 1.0f, chars_format::hex, 2000);
assert(r.ec == errc{});
assert( string_view(buffer, r.ptr - buffer) == format("{:.2000a}", 1.0f) );
}
C:\Users\Untelo\sandbox
λ cl /EHsc /W4 /WX /std:c++latest test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.29.30133 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.
test.cpp
Microsoft (R) Incremental Linker Version 14.29.30133.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
C:\Users\Untelo\sandbox
λ ./test
Assertion failed: string_view(buffer, r.ptr - buffer) == format("{:.2000a}", 1.0f), file test.cpp, line 9
Describe the bug
std::formathas a hard limit on the precision of hexadecimal floating point output.Command-line test case
Expected behavior
http://eel.is/c++draft/format.string.std#22
STL version
Version 16.11.1