1
0
mirror of https://github.com/nlohmann/json synced 2024-11-27 14:20:07 +00:00
Commit Graph

2311 Commits

Author SHA1 Message Date
abolz
9f7c2c04c8 Use the Grisu2 algorithm for formatting 'float's and 'double's 2018-01-15 21:07:26 +01:00
abolz
332f352033 Add an implementation of the Grisu2 algorithm for binary to decimal floating-point conversion
This is an attempt to fix #360. The algorithm produces
decimal representations which are guaranteed to roundtrip
and in ~99.8% actually produces the shortest possible
representation. So this is a nice compromise between using
a precision of digits10 and max_digits10.

Note 1:

The implementation only works for IEEE single/double precision
numbers. So the old implementation is kept for compatibility
with non-IEEE implementations and 'long double'.

Note 2:

If number_float_t is 'float', not all serialized numbers can
be recovered using strtod (strtof works, though). (There is
exactly one such number and the result is off by 1 ulp.)
This can be avoided by changing the implementation (the fix
is trivial), but then the resulting decimal numbers are not
exactly short.
2018-01-15 21:07:26 +01:00
abolz
0695ac4001 Add tests for #360 2018-01-15 21:07:25 +01:00
abolz
68a9736738 Tests: Re-enable some round-trip tests 2018-01-15 21:07:25 +01:00
abolz
6e2e466c27 Tests: Don't rely on the format used for floating-point formatting 2018-01-15 21:07:25 +01:00
abolz
107c21a488 Tests: Exponents are formatted with a leading '+' sign 2018-01-15 21:07:25 +01:00
abolz
3ae82d91a2 Tests: Floating-point formatting uses lower case 'e' 2018-01-15 21:07:24 +01:00
Niels Lohmann
d9446b0e6e
Merge pull request #911 from theodelrieu/fix/cmake_install
Fix/cmake install
2018-01-14 20:08:49 +01:00
Niels Lohmann
06cddd371b
🔨 removed failing amalgamation test 2018-01-14 17:22:42 +01:00
Niels Lohmann
411c16cbb2
📝 overworked documentation wrt. amalgamation #906 2018-01-14 13:08:28 +01:00
Niels Lohmann
fea5f3792b
📝 it's 2018 2018-01-14 10:41:59 +01:00
Niels Lohmann
420dcf1f25
🚧 added check whether code is amalgamated 2018-01-14 10:10:23 +01:00
Théo DELRIEU
5775084ffc
cmake: add option to use/install the non-amalgamated version 2018-01-13 13:07:03 +01:00
Théo DELRIEU
84bffd5d36
move amalgamate tool to third_party folder 2018-01-13 13:05:42 +01:00
Théo DELRIEU
922b56e492
cmake: add back trailing slash to NLOHMANN_JSON_SOURCE_DIR 2018-01-13 12:27:33 +01:00
Niels Lohmann
a66b2d20c6
🚨 removed linter warnings for Python code 2018-01-13 11:15:23 +01:00
Niels Lohmann
f4a55f26b0
added amalgamate Python script 2018-01-13 10:59:49 +01:00
Niels Lohmann
85173f5627
🔨 some clean up 2018-01-10 10:18:31 +01:00
Niels Lohmann
ce53537ba2
replaces amalgamation tool
The tool used before created a lot of duplicates inside the generated amalgamation. The new tool is a single Python file which seems to do the same job.
2018-01-09 23:15:06 +01:00
Niels Lohmann
0a2920e0fd
♻️ reorganized code 2018-01-09 18:30:02 +01:00
Niels Lohmann
b67e00b9b5
Merge pull request #700 from theodelrieu/refactor/split_it
Refactor/split it
2018-01-09 07:57:01 +01:00
Théo DELRIEU
7e4ee23f40
add single_header CMake target 2018-01-08 20:09:43 +01:00
Théo DELRIEU
57d822b6e2
add missing includes, put back include comments 2018-01-08 20:09:41 +01:00
Théo DELRIEU
9cab30cfce
add adl_serializer.hpp 2018-01-08 20:09:38 +01:00
Théo DELRIEU
8e9714fe3d
add detail/json_ref.hpp 2018-01-08 20:09:35 +01:00
Théo DELRIEU
a3473fda6a
add detail/serializer.hpp 2018-01-08 20:09:33 +01:00
Théo DELRIEU
c117515e31
add detail/parsing/binary_writer.hpp 2018-01-08 20:09:29 +01:00
Théo DELRIEU
d620f76f0d
add detail/parsing/binary_reader.hpp 2018-01-08 20:09:27 +01:00
Théo DELRIEU
4dbb433a79
add detail/parsing/output_adapters.hpp 2018-01-08 20:09:24 +01:00
Théo DELRIEU
ae6f66048c
add detail/iterators/json_reverse_iterator.hpp 2018-01-08 20:09:21 +01:00
Théo DELRIEU
5fc9ef2b90
add detail/iterators/iteration_proxy.hpp 2018-01-08 20:09:18 +01:00
Théo DELRIEU
bf06cf6c22
add detail/iterators/iter_impl.hpp 2018-01-08 20:09:15 +01:00
Théo DELRIEU
3e65a65290
add detail/iterators/internal_iterator.hpp 2018-01-08 20:09:13 +01:00
Théo DELRIEU
51ecc31db7
add detail/iterators/primitive_iterator.hpp 2018-01-08 20:09:10 +01:00
Théo DELRIEU
9ea25685a8
add detail/parsing/parser.hpp 2018-01-08 20:09:06 +01:00
Théo DELRIEU
3a0743db97
add detail/parsing/lexer.hpp 2018-01-08 20:09:04 +01:00
Théo DELRIEU
7ab3e8d7b3
add detail/parsing/input_adapters.hpp 2018-01-08 20:09:01 +01:00
Théo DELRIEU
21881606f2
add detail/conversions/to_json.hpp 2018-01-08 20:08:58 +01:00
Théo DELRIEU
e0c02c14f0
add detail/conversions/from_json.hpp 2018-01-08 20:08:55 +01:00
Théo DELRIEU
7056b375c4
add detail/value_t.hpp 2018-01-08 20:08:52 +01:00
Théo DELRIEU
8c555db970
add detail/exceptions.hpp 2018-01-08 20:08:50 +01:00
Théo DELRIEU
f364f5ac5a
add detail/meta.hpp 2018-01-08 20:08:47 +01:00
Théo DELRIEU
d686713f91
add detail/macro_{un}scope.hpp 2018-01-08 20:08:44 +01:00
Théo DELRIEU
5bffc95773
add json_fwd.hpp 2018-01-08 20:08:38 +01:00
Niels Lohmann
15b6421d07
added UTF-8 decoder capability and stress test
As described in http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt; Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> - 2015-08-28 - CC BY 4.0
2018-01-05 23:26:22 +01:00
Niels Lohmann
78f8f837e6
added items() function #874 2018-01-05 18:34:10 +01:00
Niels Lohmann
96b40b27a5
📝 fixed Doxygen warnings
Apparently, using "\n" inside an alias is an error now, but "^^" basically means the same.
2018-01-05 18:33:42 +01:00
Niels Lohmann
337e9824ea
Merge pull request #900 from Dobiasd/patch-1
fix link to the documentation of the emplace function
2018-01-04 17:11:18 +01:00
Tobias Hermann
ba2316372a
fix link to the documentation of the emplace function 2018-01-03 11:06:32 +01:00
Niels Lohmann
ce1dccf347
Merge branch 'release/3.0.1' into develop 2017-12-29 20:24:49 +01:00