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
095aae19
Commit
095aae19
authored
Aug 03, 2021
by
Sven Fink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supress -Wfloat-equal on intended float comparisions
parent
eb488bb4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
include/nlohmann/detail/output/binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+3
-0
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+3
-0
No files found.
include/nlohmann/detail/output/binary_writer.hpp
View file @
095aae19
...
@@ -1524,6 +1524,8 @@ class binary_writer
...
@@ -1524,6 +1524,8 @@ class binary_writer
void
write_compact_float
(
const
number_float_t
n
,
detail
::
input_format_t
format
)
void
write_compact_float
(
const
number_float_t
n
,
detail
::
input_format_t
format
)
{
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
if
(
static_cast
<
double
>
(
n
)
>=
static_cast
<
double
>
(
std
::
numeric_limits
<
float
>::
lowest
())
&&
if
(
static_cast
<
double
>
(
n
)
>=
static_cast
<
double
>
(
std
::
numeric_limits
<
float
>::
lowest
())
&&
static_cast
<
double
>
(
n
)
<=
static_cast
<
double
>
((
std
::
numeric_limits
<
float
>::
max
)())
&&
static_cast
<
double
>
(
n
)
<=
static_cast
<
double
>
((
std
::
numeric_limits
<
float
>::
max
)())
&&
static_cast
<
double
>
(
static_cast
<
float
>
(
n
))
==
static_cast
<
double
>
(
n
))
static_cast
<
double
>
(
static_cast
<
float
>
(
n
))
==
static_cast
<
double
>
(
n
))
...
@@ -1540,6 +1542,7 @@ class binary_writer
...
@@ -1540,6 +1542,7 @@ class binary_writer
:
get_msgpack_float_prefix
(
n
));
:
get_msgpack_float_prefix
(
n
));
write_number
(
n
);
write_number
(
n
);
}
}
#pragma GCC diagnostic pop
}
}
public:
public:
...
...
single_include/nlohmann/json.hpp
View file @
095aae19
...
@@ -14825,6 +14825,8 @@ class binary_writer
...
@@ -14825,6 +14825,8 @@ class binary_writer
void write_compact_float(const number_float_t n, detail::input_format_t format)
void write_compact_float(const number_float_t n, detail::input_format_t format)
{
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
if (static_cast<double>(n) >= static_cast<double>(std::numeric_limits<float>::lowest()) &&
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
static_cast<double>(n) <= static_cast<double>((std::numeric_limits<float>::max)()) &&
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
static_cast<double>(static_cast<float>(n)) == static_cast<double>(n))
...
@@ -14841,6 +14843,7 @@ class binary_writer
...
@@ -14841,6 +14843,7 @@ class binary_writer
: get_msgpack_float_prefix(n));
: get_msgpack_float_prefix(n));
write_number(n);
write_number(n);
}
}
#pragma GCC diagnostic pop
}
}
public:
public:
...
...
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