You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C:\Temp>type main.cpp
#include <iostream>
#include <locale>
#include <cmath>
int main()
{
std::cout << (long double)std::sqrt(-1) << std::endl;
std::cout << (double)std::sqrt(-1) << std::endl;
std::cout << (float)std::sqrt(-1) << std::endl;
std::cout.imbue(std::locale("en_us"));
std::cout << (long double)std::sqrt(-1) << std::endl;
std::cout << (double)std::sqrt(-1) << std::endl;
std::cout << (float)std::sqrt(-1) << std::endl;
return 0;
}
C:\Temp>cl /EHsc /W4 /WX /std:c++latest .\main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.37.32820 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.
main.cpp
Microsoft (R) Incremental Linker Version 14.37.32820.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
C:\Temp>.\main.exe
-nan(ind)
-nan(ind)
-nan(ind)
-na,n(i,nd)
-na,n(i,nd)
-na,n(i,nd)
Expected behavior
Should be -nan(ind) for every output
STL version
Microsoft Visual Studio Community 2022
Version 17.7.0 Preview 3.0
The text was updated successfully, but these errors were encountered:
fsb4000
changed the title
<iostream>: Wrong output for NaN<iostream>: Writing NaN to the output stream with a set locale results in a weird output
Jul 12, 2023
Command-line test case
Expected behavior
Should be
-nan(ind)
for every outputSTL version
Additional context
Devcom-10410933 / VSO-1848294 / AB#1848294
The text was updated successfully, but these errors were encountered: