aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2017-06-19 08:23:37 -0400
committerGitHub <noreply@github.com>2017-06-19 08:23:37 -0400
commit72e293a28f4be911b9dd7c79836e32a9b2b6e09d (patch)
tree3f4247db0fe291a8324da158a33849a379517669 /src
parent5729cf77f60b917ad813de9a0f68199aa2ebd388 (diff)
parentdd19b876d4c9a604946f6c4e39cc4eac5f12cfb9 (diff)
downloadprotobuf-72e293a28f4be911b9dd7c79836e32a9b2b6e09d.tar.gz
protobuf-72e293a28f4be911b9dd7c79836e32a9b2b6e09d.tar.bz2
protobuf-72e293a28f4be911b9dd7c79836e32a9b2b6e09d.zip
Merge pull request #3240 from thomasvl/float_fun
Raise the number of digits used for floats.
Diffstat (limited to 'src')
-rw-r--r--src/google/protobuf/stubs/strutil.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 336894b5..1a4d71c8 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1401,7 +1401,7 @@ char* FloatToBuffer(float value, char* buffer) {
float parsed_value;
if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) {
int snprintf_result =
- snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+2, value);
+ snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+3, value);
// Should never overflow; see above.
GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize);