kopia lustrzana https://gitlab.com/tomaszg/geostat
Correct off-by-one error in avg distance and avoid division by zero
rodzic
5296e11a21
commit
849eeaf1a5
|
@ -287,7 +287,8 @@ int main(int argc, char** argv) {
|
|||
tot_dist += cache_distance(*i->second, *std::next(i)->second);
|
||||
}
|
||||
std::cout << "Total distance between caches: <span class=\"value\">" << tot_dist << "</span> km (equivalent to <span class=\"value\">" << tot_dist / (2 * Pi * Earth_radius) << "x</span> trips around Earth)<br>\n";
|
||||
std::cout << "Average distance between caches: <span class=\"value\">" << tot_dist / sorted_fcaches.size() << "</span> km<br>\n";
|
||||
if (sorted_fcaches.size() > 1)
|
||||
std::cout << "Average distance between caches: <span class=\"value\">" << tot_dist / (sorted_fcaches.size() - 1) << "</span> km<br>\n";
|
||||
std::cout << "</div>\n";
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue