Skip to content

Commit 0624f33

Browse files
committed
isnan fixes, needed for VS2012 compiler compatibility
1 parent 1de085f commit 0624f33

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Algorithms/DouglasPeucker.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
2626
*/
2727

28+
#include <boost/math/special_functions/fpclassify.hpp>
2829
#include "DouglasPeucker.h"
2930
#include "../DataStructures/SegmentInformation.h"
3031
#include "../Util/MercatorUtil.h"
@@ -86,15 +87,15 @@ double DouglasPeucker::ComputeDistance(
8687
}
8788

8889
double r = (p - nY*a)/c;
89-
if( std::isnan(r) ) {
90+
if( boost::math::isnan(r) ) {
9091
r = ((segB.lat == point.lat) && (segB.lon == point.lon)) ? 1. : 0.;
9192
} else if( std::abs(r) <= std::numeric_limits<double>::epsilon() ) {
9293
r = 0.;
9394
} else if( std::abs(r-1.) <= std::numeric_limits<double>::epsilon() ) {
9495
r = 1.;
9596
}
9697
FixedPointCoordinate nearest_location;
97-
BOOST_ASSERT( !std::isnan(r) );
98+
BOOST_ASSERT( !boost::math::isnan(r) );
9899
if( r <= 0. ){
99100
nearest_location.lat = segA.lat;
100101
nearest_location.lon = segA.lon;

DataStructures/EdgeBasedNode.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <cmath>
55

66
#include <boost/assert.hpp>
7+
#include <boost/math/special_functions/fpclassify.hpp>
78

89
#include "../Util/MercatorUtil.h"
910
#include "../typedefs.h"
@@ -55,7 +56,7 @@ struct EdgeBasedNode {
5556
const Point foot = ComputePerpendicularFoot(p, q, r, epsilon);
5657
ratio = ComputeRatio(p, q, foot, epsilon);
5758

58-
BOOST_ASSERT( !std::isnan(ratio) );
59+
BOOST_ASSERT( !boost::math::isnan(ratio) );
5960

6061
nearest_location = ComputeNearestPointOnSegment(foot, ratio);
6162

0 commit comments

Comments
 (0)