Skip to content

Commit f8f54de

Browse files
committed
Make conversion to double explicit
1 parent 62b8ebe commit f8f54de

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

examples/osmium_amenity_list.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class AmenityHandler : public osmium::handler::Handler {
7474
c.y += nr.lat();
7575
}
7676

77-
c.x /= nr_list.size();
78-
c.y /= nr_list.size();
77+
c.x /= static_cast<double>(nr_list.size());
78+
c.y /= static_cast<double>(nr_list.size());
7979

8080
return c;
8181
}

include/osmium/area/detail/node_ref_segment.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ namespace osmium {
327327

328328
if ((d > 0 && na >= 0 && na <= d && nb >= 0 && nb <= d) ||
329329
(d < 0 && na <= 0 && na >= d && nb <= 0 && nb >= d)) {
330-
const double ua = double(na) / d;
330+
const double ua = double(na) / double(d);
331331
const vec i = p0 + ua * (p1 - p0);
332332
return osmium::Location{int32_t(i.x), int32_t(i.y)};
333333
}

include/osmium/area/detail/vector.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ namespace osmium {
8989

9090
// scale vector
9191
constexpr inline vec operator*(double s, const vec& v) noexcept {
92-
return vec{int64_t(s * v.x), int64_t(s * v.y)};
92+
return vec{int64_t(s * double(v.x)), int64_t(s * double(v.y))};
9393
}
9494

9595
// scale vector
9696
constexpr inline vec operator*(const vec& v, double s) noexcept {
97-
return vec{int64_t(s * v.x), int64_t(s * v.y)};
97+
return vec{int64_t(s * double(v.x)), int64_t(s * double(v.y))};
9898
}
9999

100100
// equality

include/osmium/util/progress_bar.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace osmium {
9191
}
9292
m_prev_percent = percent;
9393

94-
const auto num = static_cast<std::size_t>(percent * (static_cast<double>(full_length) / 100.0));
94+
const auto num = static_cast<std::size_t>(static_cast<double>(percent) * (static_cast<double>(full_length) / 100.0));
9595
std::cerr << '[';
9696
if (num >= full_length) {
9797
std::cerr << bar();

0 commit comments

Comments
 (0)