Skip to content

Commit

Permalink
Merge pull request #2121 from gistrec/fix_compilation_error_msvc
Browse files Browse the repository at this point in the history
Fixed a compilation error in MSVC
  • Loading branch information
nlohmann authored May 19, 2020
2 parents 5cfa8a5 + 9e765f5 commit a861bdb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/nlohmann/detail/output/binary_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class binary_writer
else
{
if (static_cast<double>(j.m_value.number_float) >= static_cast<double>(std::numeric_limits<float>::lowest()) and
static_cast<double>(j.m_value.number_float) <= static_cast<double>(std::numeric_limits<float>::max()) and
static_cast<double>(j.m_value.number_float) <= static_cast<double>((std::numeric_limits<float>::max)()) and
static_cast<double>(static_cast<float>(j.m_value.number_float)) == static_cast<double>(j.m_value.number_float))
{
oa->write_character(get_cbor_float_prefix(static_cast<float>(j.m_value.number_float)));
Expand Down
2 changes: 1 addition & 1 deletion single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12206,7 +12206,7 @@ class binary_writer
else
{
if (static_cast<double>(j.m_value.number_float) >= static_cast<double>(std::numeric_limits<float>::lowest()) and
static_cast<double>(j.m_value.number_float) <= static_cast<double>(std::numeric_limits<float>::max()) and
static_cast<double>(j.m_value.number_float) <= static_cast<double>((std::numeric_limits<float>::max)()) and
static_cast<double>(static_cast<float>(j.m_value.number_float)) == static_cast<double>(j.m_value.number_float))
{
oa->write_character(get_cbor_float_prefix(static_cast<float>(j.m_value.number_float)));
Expand Down
4 changes: 2 additions & 2 deletions test/src/unit-cbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ TEST_CASE("CBOR")
}
SECTION("3.40282e+38(max float)")
{
float v = std::numeric_limits<float>::max();
float v = (std::numeric_limits<float>::max)();
json j = v;
std::vector<uint8_t> expected =
{
Expand Down Expand Up @@ -953,7 +953,7 @@ TEST_CASE("CBOR")
}
SECTION("1 + 3.40282e+38(more than max float)")
{
double v = static_cast<double>(std::numeric_limits<float>::max()) + 0.1e+34;
double v = static_cast<double>((std::numeric_limits<float>::max)()) + 0.1e+34;
json j = v;
std::vector<uint8_t> expected =
{
Expand Down

0 comments on commit a861bdb

Please sign in to comment.