Supress -Wfloat-equal on intended float comparisions
This commit is contained in:
1 parent
eb488bb4d9
commit
095aae19fe
2 files changed
+6
No files matched your search
@@ -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
|
|||||||
: get_msgpack_float_prefix(n));
|
: get_msgpack_float_prefix(n));
|
||||||
write_number(n);
|
write_number(n);
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -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
|
|||||||
: get_msgpack_float_prefix(n));
|
: get_msgpack_float_prefix(n));
|
||||||
write_number(n);
|
write_number(n);
|
||||||
}
|
}
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in new issue
Block a user