diff --git a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
index 2c5816f4e..c3806c046 100644
--- a/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
+++ b/include/boost/geometry/strategies/cartesian/distance_pythagoras.hpp
@@ -85,7 +85,9 @@ public :
<
Point1,
Point2,
- CalculationType
+ CalculationType,
+ double,
+ double
>
{};
diff --git a/test/algorithms/comparable_distance.cpp b/test/algorithms/comparable_distance.cpp
index 294321c4f..f4c2d6ea2 100644
--- a/test/algorithms/comparable_distance.cpp
+++ b/test/algorithms/comparable_distance.cpp
@@ -133,8 +133,27 @@ void test_all()
test_distance_linestring
();
}
+template
+void test_double_result_from_integer()
+{
+ typedef bg::model::point point_type;
+ point_type point;
+ bg::model::linestring ls;
+ bg::read_wkt("POINT(2 2)", point);
+ bg::read_wkt("LINESTRING(4 1,1 4)", ls);
+
+ double dd = bg::distance(point, ls);
+ double dc = bg::comparable_distance(point, ls);
+
+ BOOST_CHECK_CLOSE(dd, std::sqrt(0.5), 0.001);
+ BOOST_CHECK_CLOSE(dc, 0.5, 0.001);
+}
+
int test_main(int, char* [])
{
+ test_double_result_from_integer();
+ test_double_result_from_integer();
+
//test_all >();
test_all >();
test_all >();
diff --git a/test/strategies/pythagoras.cpp b/test/strategies/pythagoras.cpp
index c250d88c0..914b80179 100644
--- a/test/strategies/pythagoras.cpp
+++ b/test/strategies/pythagoras.cpp
@@ -253,7 +253,9 @@ void test_integer(bool check_types)
if (check_types)
{
BOOST_CHECK((boost::is_same::type::value));
- BOOST_CHECK((boost::is_same::type::value));
+ // comparable_distance results in now double too, obviously because
+ // comp.distance point-segment can be fraction, even for integer input
+ BOOST_CHECK((boost::is_same::type::value));
}
}