* precisely calculates the number of digits of the source and compute the number of significant digits of the result based on that. * fix unit test * Fix warning C4267 * Optimize how we calculate the number of digits in the integer part and don't trim the value when used by the currency converter * modify GetNumberSignificantDigits * fix CI error * Access to wstring::npos from static calls * Move UnitConverter static methods related to number to NumberFormattingUtils * rename namespace * Add comment and fix typo * Move standard headers
16 lines
489 B
C++
16 lines
489 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace CalcManager::NumberFormattingUtils
|
|
{
|
|
void TrimTrailingZeros(_Inout_ std::wstring& input);
|
|
unsigned int GetNumberDigits(std::wstring value);
|
|
unsigned int GetNumberDigitsWholeNumberPart(double value);
|
|
std::wstring RoundSignificantDigits(double value, int numberSignificantDigits);
|
|
std::wstring ToScientificNumber(double number);
|
|
}
|