Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
72e293a2
Commit
72e293a2
authored
Jun 19, 2017
by
Thomas Van Lenten
Committed by
GitHub
Jun 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3240 from thomasvl/float_fun
Raise the number of digits used for floats.
parents
5729cf77
dd19b876
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
1 deletion
+3
-1
conformance_test.cc
conformance/conformance_test.cc
+1
-0
failure_list_ruby.txt
conformance/failure_list_ruby.txt
+1
-0
strutil.cc
src/google/protobuf/stubs/strutil.cc
+1
-1
No files found.
conformance/conformance_test.cc
View file @
72e293a2
...
...
@@ -759,6 +759,7 @@ bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
});
TestValidDataForType
(
FieldDescriptor
::
TYPE_FLOAT
,
{
{
flt
(
0.1
),
"0.1"
},
{
flt
(
1.00000075e-36
),
"1.00000075e-36"
},
{
flt
(
3.402823e+38
),
"3.402823e+38"
},
// 3.40282347e+38
{
flt
(
1.17549435e-38
f
),
"1.17549435e-38"
}
});
...
...
conformance/failure_list_ruby.txt
View file @
72e293a2
...
...
@@ -199,5 +199,6 @@ Required.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
Required.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
Required.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
Required.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
Required.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
Required.TimestampProtoInputTooLarge.JsonOutput
Required.TimestampProtoInputTooSmall.JsonOutput
src/google/protobuf/stubs/strutil.cc
View file @
72e293a2
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment