From da70f6d374617a06b36b20a24d53b44e1ee7f692 Mon Sep 17 00:00:00 2001 From: jules Date: Sat, 10 Aug 2013 10:24:45 +0100 Subject: [PATCH] Fix for string->double default precision. --- modules/juce_core/text/juce_String.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/juce_core/text/juce_String.cpp b/modules/juce_core/text/juce_String.cpp index d9ba4b2226..60a948cfb9 100644 --- a/modules/juce_core/text/juce_String.cpp +++ b/modules/juce_core/text/juce_String.cpp @@ -431,7 +431,10 @@ namespace NumberToStringConverters { { std::ostream o (this); - o.precision ((std::streamsize) numDecPlaces); + + if (numDecPlaces > 0) + o.precision ((std::streamsize) numDecPlaces); + o << n; } @@ -467,7 +470,7 @@ namespace NumberToStringConverters } StackArrayStream strm (buffer); - len = strm.writeDouble (n, numDecPlaces <= 0 ? 20 : numDecPlaces); + len = strm.writeDouble (n, numDecPlaces); jassert (len <= charsNeededForDouble); return buffer; }