Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkichler committed Oct 24, 2024
1 parent a027a6f commit bcc8b3d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
22 changes: 11 additions & 11 deletions include/cuinterval/arithmetic/basic.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -919,25 +919,25 @@ inline constexpr __device__ interval<T> rootn(interval<T> x, std::integral auto
return x;
}

auto rootn_pos_n = [](interval<T> x, std::integral auto n) -> interval<T> {
if (n == 0) {
auto rootn_pos_n = [](interval<T> y, std::integral auto m) -> interval<T> {
if (m == 0) {
return empty<T>();
} else if (n == 1) {
return x;
} else if (n == 2) {
return sqrt(x);
} else if (m == 1) {
return y;
} else if (m == 2) {
return sqrt(y);
} else {
bool is_odd = n % 2;
bool is_odd = m % 2;
interval<T> domain { is_odd ? intrinsic::neg_inf<T>() : static_cast<T>(0),
intrinsic::pos_inf<T>() };

x = intersection(x, domain);
if (empty(x)) {
y = intersection(y, domain);
if (empty(y)) {
return empty<T>();
}

return { intrinsic::next_after(pow(inf(x), 1.0 / n), domain.lb),
intrinsic::next_after(pow(sup(x), 1.0 / n), domain.ub) };
return { intrinsic::next_after(pow(inf(y), 1.0 / m), domain.lb),
intrinsic::next_after(pow(sup(y), 1.0 / m), domain.ub) };
}
};

Expand Down
3 changes: 2 additions & 1 deletion include/cuinterval/interval.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ constexpr bool operator==(interval<T> lhs, interval<T> rhs)
{
auto empty = [](interval<T> x) { return !(x.lb <= x.ub); };

return (empty(lhs) && empty(rhs)) || lhs.lb == rhs.lb && lhs.ub == rhs.ub;

return (empty(lhs) && empty(rhs)) || (lhs.lb == rhs.lb && lhs.ub == rhs.ub);
}

template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <cstddef>
#include <cstdio>

int main(int argc, char *argv[])
int main()
{
CUDA_CHECK(cudaSetDevice(0));

Expand Down
2 changes: 1 addition & 1 deletion tests/tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ bool check_within_ulps(T x, T y, std::size_t n, T direction)
return true;
}

for (int i = 0; i < n; ++i) {
for (auto i = 0u; i < n; ++i) {
y = std::nextafter(y, direction);

if (x == y) {
Expand Down
2 changes: 0 additions & 2 deletions tests/tests_loop.cu
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ std::vector<interval<double>> compute_pi_approximation(cudaStream_t stream)
auto tr_last = thrust::make_transform_iterator(seq_last, to_interval_fn());
auto pi_rcp_first = thrust::make_transform_iterator(tr_first, pi_recip_fn());
auto pi_rcp_last = thrust::make_transform_iterator(tr_last, pi_recip_fn());
auto pi_pow_first = thrust::make_transform_iterator(tr_first, pi_pow_fn());
auto pi_pow_last = thrust::make_transform_iterator(tr_last, pi_pow_fn());
auto pi_inv_first = thrust::make_transform_iterator(tr_first, pi_inv_fn());
auto pi_inv_last = thrust::make_transform_iterator(tr_last, pi_inv_fn());

Expand Down

0 comments on commit bcc8b3d

Please sign in to comment.