Don't generate a format specifier length of ":"

It's ambiguous, are we talking the length of a human colon or a pigs?

Fix #7556
This commit is contained in:
Marek Roszko 2021-02-17 18:52:56 -05:00
parent dbd04b3fe1
commit b80fdad511
1 changed files with 7 additions and 2 deletions

View File

@ -37,8 +37,7 @@ static wxString formatFloat( double x, int nDigits )
if( nDigits )
{
fmt = wxT( "%.0Nf" );
fmt[3] = '0' + nDigits;
fmt.Printf( "%%.0%df", nDigits );
}
else
{
@ -102,6 +101,12 @@ static void getSISuffix( double x, const wxString& unit, int& power, wxString& s
static int countDecimalDigits( double x, int maxDigits )
{
if( std::isnan( x ) )
{
// avoid trying to count the decimals of NaN
return 0;
}
int64_t k = (int)( ( x - floor( x ) ) * pow( 10.0, (double) maxDigits ) );
int n = 0;