Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a compilation error in MSVC #2121

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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