removing all FLT_EPSILONs

This commit is contained in:
Dennis Luxen 2013-10-02 13:05:54 +02:00
parent 770a07cc28
commit bf8505a285
5 changed files with 7 additions and 7 deletions

View File

@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include <boost/make_shared.hpp> #include <boost/make_shared.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <cfloat>
#include <ctime> #include <ctime>
#include <algorithm> #include <algorithm>
@ -732,7 +731,7 @@ private:
if ( priority > targetPriority ) if ( priority > targetPriority )
return false; return false;
//tie breaking //tie breaking
if ( fabs(priority - targetPriority) < FLT_EPSILON && bias(node, target) ) { if ( fabs(priority - targetPriority) < std::numeric_limits<double>::epsilon() && bias(node, target) ) {
return false; return false;
} }
neighbours.push_back( target ); neighbours.push_back( target );
@ -754,7 +753,7 @@ private:
if ( priority > targetPriority) if ( priority > targetPriority)
return false; return false;
//tie breaking //tie breaking
if ( fabs(priority - targetPriority) < FLT_EPSILON && bias(node, target) ) { if ( fabs(priority - targetPriority) < std::numeric_limits<double>::epsilon() && bias(node, target) ) {
return false; return false;
} }
} }

View File

@ -467,7 +467,7 @@ public:
//initialize queue with root element //initialize queue with root element
std::priority_queue<QueryCandidate> traversal_queue; std::priority_queue<QueryCandidate> traversal_queue;
traversal_queue.push(QueryCandidate(0, m_search_tree[0].minimum_bounding_rectangle.GetMinDist(input_coordinate))); traversal_queue.push(QueryCandidate(0, m_search_tree[0].minimum_bounding_rectangle.GetMinDist(input_coordinate)));
BOOST_ASSERT_MSG(FLT_EPSILON > (0. - traversal_queue.top().min_dist), "Root element in NN Search has min dist != 0."); BOOST_ASSERT_MSG(std::numberic_limits<double>::epsilon() > (0. - traversal_queue.top().min_dist), "Root element in NN Search has min dist != 0.");
while(!traversal_queue.empty()) { while(!traversal_queue.empty()) {
const QueryCandidate current_query_node = traversal_queue.top(); traversal_queue.pop(); const QueryCandidate current_query_node = traversal_queue.top(); traversal_queue.pop();

View File

@ -166,7 +166,7 @@ void DescriptionFactory::Run(const SearchEngine &sEngine, const unsigned zoomLev
// SimpleLogger().Write() << "#segs: " << pathDescription.size(); // SimpleLogger().Write() << "#segs: " << pathDescription.size();
//Post-processing to remove empty or nearly empty path segments //Post-processing to remove empty or nearly empty path segments
if(FLT_EPSILON > pathDescription.back().length) { if(std::numeric_limits<double>::epsilon() > pathDescription.back().length) {
// SimpleLogger().Write() << "#segs: " << pathDescription.size() << ", last ratio: " << targetPhantom.ratio << ", length: " << pathDescription.back().length; // SimpleLogger().Write() << "#segs: " << pathDescription.size() << ", last ratio: " << targetPhantom.ratio << ", length: " << pathDescription.back().length;
if(pathDescription.size() > 2){ if(pathDescription.size() > 2){
pathDescription.pop_back(); pathDescription.pop_back();
@ -178,7 +178,7 @@ void DescriptionFactory::Run(const SearchEngine &sEngine, const unsigned zoomLev
} else { } else {
pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio); pathDescription[indexOfSegmentBegin].duration *= (1.-targetPhantom.ratio);
} }
if(FLT_EPSILON > pathDescription[0].length) { if(std::numeric_limits<double>::epsilon() > pathDescription[0].length) {
//TODO: this is never called actually? //TODO: this is never called actually?
if(pathDescription.size() > 2) { if(pathDescription.size() > 2) {
pathDescription.erase(pathDescription.begin()); pathDescription.erase(pathDescription.begin());

View File

@ -30,6 +30,7 @@
#include "../Util/SimpleLogger.h" #include "../Util/SimpleLogger.h"
#include "../typedefs.h" #include "../typedefs.h"
#include <limits>
#include <vector> #include <vector>
/* This class is fed with all way segments in consecutive order /* This class is fed with all way segments in consecutive order

View File

@ -56,7 +56,7 @@ void ExtractorCallbacks::wayFunction(ExtractionWay &parsed_way) {
parsed_way.speed = parsed_way.duration/(parsed_way.path.size()-1); parsed_way.speed = parsed_way.duration/(parsed_way.path.size()-1);
} }
if(FLT_EPSILON >= fabs(-1. - parsed_way.speed)){ if(std::numeric_limits<double>::epsilon() >= fabs(-1. - parsed_way.speed)){
SimpleLogger().Write(logDEBUG) << SimpleLogger().Write(logDEBUG) <<
"found way with bogus speed, id: " << parsed_way.id; "found way with bogus speed, id: " << parsed_way.id;
return; return;