From e25e38b8211f3ec669c4811191770f150156e16f Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 10 Jun 2015 16:47:43 +0200 Subject: [PATCH] save float comparison; fixed syntax error --- src/main.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 10c4e8a..bbdcad4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -244,10 +244,10 @@ DelayMap calc_pinger_delays(const HostList &hosts) // for random intervals, use random delays within intervals BOOST_FOREACH( IntervalCountPair interval_and_count, delay_shifts ) { - if ( interval_and_count.second == 1 ) + if ( abs(interval_and_count.second - 1.0f) < 0.0001 ) // == 1.0f { // there is exactly 1 pinger with exactly that interval // --> assign a random delay within interval - rand_dist_type random_distribution(0, interval_and_count.first); + rand_dist_type random_distribution(0.0f, interval_and_count.first); rand_var_type random_variate(random_number_generator, random_distribution); delay_shifts[interval_and_count.first] = random_variate(); @@ -257,7 +257,7 @@ DelayMap calc_pinger_delays(const HostList &hosts) // --> distribute evenly delay_shifts[interval_and_count.first] = boost::numeric_cast(interval_and_count.first) / - std:max(1.0f, interval_and_count.second); // max is paranoid + std::max(1.0f, interval_and_count.second); //max is paranoid } } -- 1.7.1