mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-24 04:00:02 +01:00
Fix calculator appending extra zeros on non-en-US locales (#45624)
The C++ expression engine formatted results using the system locale, which could produce comma decimal separators (e.g. "8,000000000000000"). The C# side then parsed this with en-US culture, interpreting commas as thousands separators, turning 8 into 8000000000000000. Fix: imbue the classic (C) locale on the output stream to always use a dot decimal separator regardless of system locale. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,7 @@ namespace ExprtkCalculator::internal
|
||||
std::wstring ToWStringFullPrecision(double value)
|
||||
{
|
||||
std::wostringstream oss;
|
||||
oss.imbue(std::locale::classic());
|
||||
oss << std::fixed << std::setprecision(15) << value;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user