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
4620960b
Commit
4620960b
authored
Jan 25, 2016
by
Trevor Welsby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable problematic test for GCC/clang, remove debug dump from unit.cpp
parent
12ef6683
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
16 deletions
+8
-16
src/json.hpp
src/json.hpp
+3
-3
src/json.hpp.re2c
src/json.hpp.re2c
+3
-3
test/unit.cpp
test/unit.cpp
+2
-10
No files found.
src/json.hpp
View file @
4620960b
...
@@ -7637,7 +7637,7 @@ basic_json_parser_64:
...
@@ -7637,7 +7637,7 @@ basic_json_parser_64:
@return the floating point number
@return the floating point number
*/
*/
long
double
str_to_float_t
(
long
double
*
type
,
char
**
endptr
)
const
long
double
str_to_float_t
(
long
double
*
/* type */
,
char
**
endptr
)
const
{
{
return
std
::
strtold
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
return
std
::
strtold
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
}
}
...
@@ -7656,7 +7656,7 @@ basic_json_parser_64:
...
@@ -7656,7 +7656,7 @@ basic_json_parser_64:
@return the floating point number
@return the floating point number
*/
*/
double
str_to_float_t
(
double
*
type
,
char
**
endptr
)
const
double
str_to_float_t
(
double
*
/* type */
,
char
**
endptr
)
const
{
{
return
std
::
strtod
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
return
std
::
strtod
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
}
}
...
@@ -7675,7 +7675,7 @@ basic_json_parser_64:
...
@@ -7675,7 +7675,7 @@ basic_json_parser_64:
@return the floating point number
@return the floating point number
*/
*/
float
str_to_float_t
(
float
*
type
,
char
**
endptr
)
const
float
str_to_float_t
(
float
*
/* type */
,
char
**
endptr
)
const
{
{
return
std
::
strtof
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
return
std
::
strtof
(
reinterpret_cast
<
typename
string_t
::
const_pointer
>
(
m_start
),
endptr
);
}
}
...
...
src/json.hpp.re2c
View file @
4620960b
...
@@ -7319,7 +7319,7 @@ class basic_json
...
@@ -7319,7 +7319,7 @@ class basic_json
@return the floating point number
@return the floating point number
*/
*/
long double str_to_float_t(long double*
type
, char** endptr) const
long double str_to_float_t(long double*
/* type */
, char** endptr) const
{
{
return std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
return std::strtold(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
}
}
...
@@ -7338,7 +7338,7 @@ class basic_json
...
@@ -7338,7 +7338,7 @@ class basic_json
@return the floating point number
@return the floating point number
*/
*/
double str_to_float_t(double*
type
, char** endptr) const
double str_to_float_t(double*
/* type */
, char** endptr) const
{
{
return std::strtod(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
return std::strtod(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
}
}
...
@@ -7357,7 +7357,7 @@ class basic_json
...
@@ -7357,7 +7357,7 @@ class basic_json
@return the floating point number
@return the floating point number
*/
*/
float str_to_float_t(float*
type
, char** endptr) const
float str_to_float_t(float*
/* type */
, char** endptr) const
{
{
return std::strtof(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
return std::strtof(reinterpret_cast<typename string_t::const_pointer>(m_start), endptr);
}
}
...
...
test/unit.cpp
View file @
4620960b
...
@@ -12263,18 +12263,10 @@ TEST_CASE("regression tests")
...
@@ -12263,18 +12263,10 @@ TEST_CASE("regression tests")
j = json::parse("0.999999999999999944488848768742172978818416595458984374");
j = json::parse("0.999999999999999944488848768742172978818416595458984374");
CHECK(j.get<double>() == 0.99999999999999989);
CHECK(j.get<double>() == 0.99999999999999989);
#if !defined(__clang__) && !defined(__GNUC__) && !defined(__GNUG__)
j = json::parse("1.00000000000000011102230246251565404236316680908203126");
j = json::parse("1.00000000000000011102230246251565404236316680908203126");
CHECK(j.get<double>() == 1.00000000000000022);
CHECK(j.get<double>() == 1.00000000000000022);
union
double_union
{
double
_double
;
uint64_t
_uint64_t
;
};
#endif
double_union
A
,
B
,
C
;
char
*
endptr
;
A
.
_double
=
1.00000000000000022
;
B
.
_double
=
std
::
strtod
(
"1.00000000000000011102230246251565404236316680908203126"
,
&
endptr
);
C
.
_double
=
j
.
get
<
double
>
();
std
::
cout
<<
"Literal -> "
<<
std
::
hex
<<
A
.
_uint64_t
<<
std
::
endl
;
std
::
cout
<<
"strtod() -> "
<<
std
::
hex
<<
B
.
_uint64_t
<<
std
::
endl
;
std
::
cout
<<
"Parsed -> "
<<
std
::
hex
<<
C
.
_uint64_t
<<
std
::
endl
;
std
::
cout
<<
"Type == "
<<
std
::
dec
<<
static_cast
<
int
>
(
j
.
type
())
<<
std
::
endl
;
j = json::parse("7205759403792793199999e-5");
j = json::parse("7205759403792793199999e-5");
CHECK(j.get<double>() == 72057594037927928.0);
CHECK(j.get<double>() == 72057594037927928.0);
...
...
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