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
5c8d0af5
Unverified
Commit
5c8d0af5
authored
Jul 10, 2021
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
📝
add comment for handling of negative zeros #2854
parent
098bbab0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
doc/mkdocs/docs/features/types/number_handling.md
doc/mkdocs/docs/features/types/number_handling.md
+15
-0
No files found.
doc/mkdocs/docs/features/types/number_handling.md
View file @
5c8d0af5
...
...
@@ -96,6 +96,21 @@ This is the same behavior as the code `#!c double x = 3.141592653589793238462643
- All integers outside the range $[-2^{63}, 2^{64}-1]$, as well as floating-point numbers are stored as `double`.
This also concurs with the specification above.
### Zeros
The JSON number grammar allows for different ways to express zero, and this library will store zeros differently:
| Literal | Stored value and type | Serialization |
| ------- | --------------------- | ------------- |
|
`0`
|
`#!c std::uint64_t(0)`
|
`0`
|
|
`-0`
|
`#!c std::int64_t(0)`
|
`0`
|
|
`0.0`
|
`#!c double(0.0)`
|
`0.0`
|
|
`-0.0`
|
`#!c double(-0.0)`
|
`-0.0`
|
|
`0E0`
|
`#!c double(0.0)`
|
`0.0`
|
|
`-0E0`
|
`#!c double(-0.0)`
|
`-0.0`
|
That is,
`-0`
is stored as a signed integer, but the serialization does not reproduce the
`-`
.
### Number serialization
-
Integer numbers are serialized as is; that is, no scientific notation is used.
...
...
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