This is an automated email from the ASF dual-hosted git repository. alsay pushed a commit to branch cleanup_warnings in repository https://gitbox.apache.org/repos/asf/datasketches-cpp.git
commit 93c1589b2248dce55b8c0c20fce01e550230de69 Author: Alexander Saydakov <[email protected]> AuthorDate: Tue Mar 30 14:21:48 2021 -0700 types and casts --- common/include/bounds_binomial_proportions.hpp | 12 ++++++------ theta/test/theta_a_not_b_test.cpp | 2 +- theta/test/theta_intersection_test.cpp | 2 +- theta/test/theta_jaccard_similarity_test.cpp | 4 ++-- theta/test/theta_sketch_test.cpp | 2 +- theta/test/theta_union_test.cpp | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/include/bounds_binomial_proportions.hpp b/common/include/bounds_binomial_proportions.hpp index ffeccb2..abfe8db 100644 --- a/common/include/bounds_binomial_proportions.hpp +++ b/common/include/bounds_binomial_proportions.hpp @@ -117,7 +117,7 @@ public: else if (k == 1) { return (exact_lower_bound_on_p_k_eq_1(n, delta_of_num_stdevs(num_std_devs))); } else if (k == n) { return (exact_lower_bound_on_p_k_eq_n(n, delta_of_num_stdevs(num_std_devs))); } else { - double x = abramowitz_stegun_formula_26p5p22((n - k) + 1, k, (-1.0 * num_std_devs)); + double x = abramowitz_stegun_formula_26p5p22((n - k) + 1.0, static_cast<double>(k), (-1.0 * num_std_devs)); return (1.0 - x); // which is p } } @@ -156,7 +156,7 @@ public: return (exact_upper_bound_on_p_k_eq_zero(n, delta_of_num_stdevs(num_std_devs))); } else { - double x = abramowitz_stegun_formula_26p5p22(n - k, k + 1, num_std_devs); + double x = abramowitz_stegun_formula_26p5p22(static_cast<double>(n - k), k + 1.0, num_std_devs); return (1.0 - x); // which is p } } @@ -265,19 +265,19 @@ private: // Formulas for some special cases. - static inline double exact_upper_bound_on_p_k_eq_zero(double n, double delta) { + static inline double exact_upper_bound_on_p_k_eq_zero(uint64_t n, double delta) { return (1.0 - pow(delta, (1.0 / n))); } - static inline double exact_lower_bound_on_p_k_eq_n(double n, double delta) { + static inline double exact_lower_bound_on_p_k_eq_n(uint64_t n, double delta) { return (pow(delta, (1.0 / n))); } - static inline double exact_lower_bound_on_p_k_eq_1(double n, double delta) { + static inline double exact_lower_bound_on_p_k_eq_1(uint64_t n, double delta) { return (1.0 - pow((1.0 - delta), (1.0 / n))); } - static inline double exact_upper_bound_on_p_k_eq_minusone(double n, double delta) { + static inline double exact_upper_bound_on_p_k_eq_minusone(uint64_t n, double delta) { return (pow((1.0 - delta), (1.0 / n))); } diff --git a/theta/test/theta_a_not_b_test.cpp b/theta/test/theta_a_not_b_test.cpp index 1ef5255..4e6ff26 100644 --- a/theta/test/theta_a_not_b_test.cpp +++ b/theta/test/theta_a_not_b_test.cpp @@ -37,7 +37,7 @@ TEST_CASE("theta a-not-b: empty", "[theta_a_not_b]") { TEST_CASE("theta a-not-b: non empty no retained keys", "[theta_a_not_b]") { update_theta_sketch a = update_theta_sketch::builder().build(); a.update(1); - update_theta_sketch b = update_theta_sketch::builder().set_p(0.001).build(); + update_theta_sketch b = update_theta_sketch::builder().set_p(0.001f).build(); theta_a_not_b a_not_b; // B is still empty diff --git a/theta/test/theta_intersection_test.cpp b/theta/test/theta_intersection_test.cpp index 2c8d6c0..c8fb6e6 100644 --- a/theta/test/theta_intersection_test.cpp +++ b/theta/test/theta_intersection_test.cpp @@ -48,7 +48,7 @@ TEST_CASE("theta intersection: empty", "[theta_intersection]") { } TEST_CASE("theta intersection: non empty no retained keys", "[theta_intersection]") { - update_theta_sketch sketch = update_theta_sketch::builder().set_p(0.001).build(); + update_theta_sketch sketch = update_theta_sketch::builder().set_p(0.001f).build(); sketch.update(1); theta_intersection intersection; intersection.update(sketch); diff --git a/theta/test/theta_jaccard_similarity_test.cpp b/theta/test/theta_jaccard_similarity_test.cpp index 9354d1c..d40a0ce 100644 --- a/theta/test/theta_jaccard_similarity_test.cpp +++ b/theta/test/theta_jaccard_similarity_test.cpp @@ -107,7 +107,7 @@ TEST_CASE("theta jaccard: half overlap estimation mode", "[theta_sketch]") { TEST_CASE("theta jaccard: similarity test", "[theta_sketch]") { const int8_t min_lg_k = 12; const int u1 = 1 << 20; - const int u2 = u1 * 0.95; + const int u2 = static_cast<int>(u1 * 0.95); const double threshold = 0.943; auto expected = update_theta_sketch::builder().set_lg_k(min_lg_k).build(); @@ -127,7 +127,7 @@ TEST_CASE("theta jaccard: similarity test", "[theta_sketch]") { TEST_CASE("theta jaccard: dissimilarity test", "[theta_sketch]") { const int8_t min_lg_k = 12; const int u1 = 1 << 20; - const int u2 = u1 * 0.05; + const int u2 = static_cast<int>(u1 * 0.05); const double threshold = 0.061; auto expected = update_theta_sketch::builder().set_lg_k(min_lg_k).build(); diff --git a/theta/test/theta_sketch_test.cpp b/theta/test/theta_sketch_test.cpp index f817a3e..eeb2a73 100644 --- a/theta/test/theta_sketch_test.cpp +++ b/theta/test/theta_sketch_test.cpp @@ -50,7 +50,7 @@ TEST_CASE("theta sketch: empty", "[theta_sketch]") { } TEST_CASE("theta sketch: non empty no retained keys", "[theta_sketch]") { - update_theta_sketch update_sketch = update_theta_sketch::builder().set_p(0.001).build(); + update_theta_sketch update_sketch = update_theta_sketch::builder().set_p(0.001f).build(); update_sketch.update(1); //std::cerr << update_sketch.to_string(); REQUIRE(update_sketch.get_num_retained() == 0); diff --git a/theta/test/theta_union_test.cpp b/theta/test/theta_union_test.cpp index e45862d..c170457 100644 --- a/theta/test/theta_union_test.cpp +++ b/theta/test/theta_union_test.cpp @@ -39,7 +39,7 @@ TEST_CASE("theta union: empty", "[theta_union]") { } TEST_CASE("theta union: non empty no retained keys", "[theta_union]") { - update_theta_sketch update_sketch = update_theta_sketch::builder().set_p(0.001).build(); + update_theta_sketch update_sketch = update_theta_sketch::builder().set_p(0.001f).build(); update_sketch.update(1); theta_union u = theta_union::builder().build(); u.update(update_sketch); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
