Remove trailing zeros from all values

If we are showing a value to the end user, we should avoid unneeded
precision
This commit is contained in:
Seth Hillbrand 2024-04-18 18:11:35 -07:00
parent d8b6e28890
commit abd0388794
1 changed files with 7 additions and 0 deletions

View File

@ -464,6 +464,13 @@ wxString EDA_UNIT_UTILS::UI::MessageTextFromValue( const EDA_IU_SCALE& aIuScale,
} }
text.Printf( format, value ); text.Printf( format, value );
removeTrailingZeros( text );
if( value != 0.0 && ( text == wxS( "0" ) || text == wxS( "-0" ) ) )
{
text.Printf( wxS( "%.10f" ), value );
removeTrailingZeros( text );
}
if( aAddUnitsText ) if( aAddUnitsText )
text += EDA_UNIT_UTILS::GetText( aUnits, aType ); text += EDA_UNIT_UTILS::GetText( aUnits, aType );