Re: [Boost-bugs] [Boost C++ Libraries] #12268: Boost Polygon: Overflow issue with euclidean_distance() when using large (32-bit) coordinates.

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #12268: Boost Polygon: Overflow issue with euclidean_distance() when using large (32-bit) coordinates.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-06-15 20:49:28


#12268: Boost Polygon: Overflow issue with euclidean_distance() when using large
(32-bit) coordinates.
---------------------------------------------+-----------------------------
  Reporter: Pallav Gupta <drpallavgupta@…> | Owner: ljsimons
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: polygon
   Version: Boost 1.61.0 | Severity: Problem
Resolution: | Keywords:
                                             | euclidean_distance
---------------------------------------------+-----------------------------

Comment (by anonymous):

 I think the problem is in the code fragment below. Don't know why the
 return value of square_euclidean_distance() is being casted on an 'int'.



 {{{
   template <typename rectangle_type, typename rectangle_type_2>
   typename enable_if< typename gtl_and_3<y_r_edist2, typename
 is_rectangle_concept<typename
 geometry_concept<rectangle_type>::type>::type,
                                                           typename
 is_rectangle_concept<typename
 geometry_concept<rectangle_type_2>::type>::type>::type,
                        typename
 rectangle_distance_type<rectangle_type>::type>::type
   euclidean_distance(const rectangle_type& lvalue, const rectangle_type_2&
 rvalue) {
     double val = (int)square_euclidean_distance(lvalue, rvalue);
     return std::sqrt(val);
   }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12268#comment:2>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:20 UTC