Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
9b9919d4
Commit
9b9919d4
authored
Jan 15, 2018
by
abolz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use max_digits10 in dump_float for float->text->float round-trip
parent
810f81bb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
develop/detail/serializer.hpp
develop/detail/serializer.hpp
+2
-2
src/json.hpp
src/json.hpp
+2
-2
No files found.
develop/detail/serializer.hpp
View file @
9b9919d4
...
...
@@ -665,8 +665,8 @@ class serializer
void
dump_float
(
number_float_t
x
,
std
::
false_type
/*is_ieee_single_or_double*/
)
{
// get number of digits for a
text -> float -> tex
t round-trip
static
constexpr
auto
d
=
std
::
numeric_limits
<
number_float_t
>::
digits10
;
// get number of digits for a
float -> text -> floa
t round-trip
static
constexpr
auto
d
=
std
::
numeric_limits
<
number_float_t
>::
max_
digits10
;
// the actual conversion
std
::
ptrdiff_t
len
=
snprintf
(
number_buffer
.
data
(),
number_buffer
.
size
(),
"%.*g"
,
d
,
x
);
...
...
src/json.hpp
View file @
9b9919d4
...
...
@@ -8136,8 +8136,8 @@ class serializer
void dump_float(number_float_t x, std::false_type /*is_ieee_single_or_double*/)
{
// get number of digits for a
text -> float -> tex
t round-trip
static
constexpr
auto
d
=
std
::
numeric_limits
<
number_float_t
>::
digits10
;
// get number of digits for a
float -> text -> floa
t round-trip
static constexpr auto d = std::numeric_limits<number_float_t>::
max_
digits10;
// the actual conversion
std::ptrdiff_t len = snprintf(number_buffer.data(), number_buffer.size(), "%.*g", d, x);
...
...
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