Sup,

i'm not sure but ...

`/**`

* Gets the radian-angle to another Target on the Globe.

* @param target - pointer to other target

* @return, distance in radians

*/

double Target::getDistance(const Target* const target) const

{

const double lonTarget (target->getLongitude());

const double latTarget (target->getLatitude());

if (AreSameTwo(

_lon, lonTarget,

_lat, latTarget))

{

return 0.;

}

// else the formula below returns NaN <-----

return std::acos(

std::cos(_lat)

* std::cos(latTarget)

* std::cos(lonTarget - _lon)

+ std::sin(_lat)

* std::sin(latTarget));

}

might be worth a shot,

EDIT: I ended up writing this and sprinkling it around in various places (not necessarily the predict-destination routines exclusively)

`/**`

* Checks if val1 or val2 (lon,lat) is NaN or Inf.

* @note Checks validity of Globe coordinates.

* @param val1 - x-coordinate

* @param val2 - y-coordinate

* @return, true if either val1 or val2 is NaN or Inf

*/

template<class _Tx>

inline bool isNaNorInf(

const _Tx& val1,

const _Tx& val2)

{

if ( std::isnan(val1) || std::isnan(val2)

|| std::isinf(val1) || std::isinf(val2))

{

return true;

}

return false;

}