From d716b61b1e30fd0f6c8de61cd743f4d26a332a0a Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Tue, 23 Oct 2018 19:55:15 +0100 Subject: [PATCH] Increase precision for doubles/string conversion Required so that the Select: command has reasonable precision on tracks longer than 17 minutes. --- include/audacity/EffectAutomationParameters.h | 2 +- src/WrappedType.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/audacity/EffectAutomationParameters.h b/include/audacity/EffectAutomationParameters.h index d1a077b2f..64542263a 100644 --- a/include/audacity/EffectAutomationParameters.h +++ b/include/audacity/EffectAutomationParameters.h @@ -130,7 +130,7 @@ public: virtual bool DoWriteDouble(const wxString & key, double value) override { - return DoWriteString(key, wxString::Format(wxT("%g"), value)); + return DoWriteString(key, wxString::Format(wxT("%.8g"), value)); } bool ReadFloat(const wxString & key, float *pf) const diff --git a/src/WrappedType.cpp b/src/WrappedType.cpp index d44c82fc0..768cfd12f 100644 --- a/src/WrappedType.cpp +++ b/src/WrappedType.cpp @@ -114,7 +114,7 @@ wxString WrappedType::ReadAsString() return wxString::Format(wxT("%i"),*mpInt ); break; case eWrappedDouble: - return wxString::Format(wxT("%g"),*mpDouble ); + return wxString::Format(wxT("%.8g"),*mpDouble ); break; case eWrappedBool: return (* mpBool) ? wxT("true") : wxT("false" ); @@ -272,7 +272,7 @@ void WrappedType::WriteToAsDouble( const double InDouble) switch( eWrappedType ) { case eWrappedString: - *mpStr = wxString::Format( wxT("%g"), InDouble ); + *mpStr = wxString::Format( wxT("%.8g"), InDouble ); break; case eWrappedInt: *mpInt = (int)InDouble;