Skip to content
Draft
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
5 changes: 3 additions & 2 deletions src/vcpkg-test/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <vcpkg/base/json.h>
#include <vcpkg/base/messages.h>

#include <cmath>
#include <iostream>

// TODO: remove this once we switch to C++20 completely
Expand Down Expand Up @@ -150,12 +151,12 @@ TEST_CASE ("JSON parse floats", "[json]")
REQUIRE(res.get()->value.is_number());
REQUIRE(!res.get()->value.is_integer());
REQUIRE(res.get()->value.number(VCPKG_LINE_INFO) == 0.0);
REQUIRE(!signbit(res.get()->value.number(VCPKG_LINE_INFO)));
REQUIRE(!std::signbit(res.get()->value.number(VCPKG_LINE_INFO)));
res = Json::parse("-0.0", "test");
REQUIRE(res);
REQUIRE(res.get()->value.is_number());
REQUIRE(res.get()->value.number(VCPKG_LINE_INFO) == 0.0);
REQUIRE(signbit(res.get()->value.number(VCPKG_LINE_INFO)));
REQUIRE(std::signbit(res.get()->value.number(VCPKG_LINE_INFO)));
res = Json::parse("12345.6789", "test");
REQUIRE(res);
REQUIRE(res.get()->value.is_number());
Expand Down
5 changes: 2 additions & 3 deletions src/vcpkg/base/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

#include <vcpkg/documentation.h>

#include <math.h>

#include <atomic>
#include <cmath>
#include <type_traits>

namespace vcpkg::Json
Expand Down Expand Up @@ -320,7 +319,7 @@ namespace vcpkg::Json
}
Value Value::number(double d) noexcept
{
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, isfinite(d));
vcpkg::Checks::check_exit(VCPKG_LINE_INFO, std::isfinite(d));
Value val;
val.underlying_ = std::make_unique<ValueImpl>(ValueKindConstant<VK::Number>(), d);
return val;
Expand Down
5 changes: 2 additions & 3 deletions src/vcpkg/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include <vcpkg/metrics.h>
#include <vcpkg/paragraphs.h>

#include <math.h>

#include <cmath>
#include <iterator>
#include <limits>
#include <mutex>
Expand Down Expand Up @@ -190,7 +189,7 @@ namespace vcpkg

void MetricsSubmission::track_elapsed_us(double value)
{
if (!isfinite(value) || value < 0.0)
if (!std::isfinite(value) || value < 0.0)
{
value = 0.0;
}
Expand Down