Merge pull request #2833 from afabri/CGAL-is_finite-GF

Number_types: Call std::isfinite() if possible
This commit is contained in:
Laurent Rineau 2018-02-19 14:27:41 +01:00
commit 8aadb06cf1
2 changed files with 8 additions and 2 deletions

View File

@ -169,10 +169,13 @@ template <> class Real_embeddable_traits< double >
: public CGAL::unary_function< Type, bool > {
public :
bool operator()( const Type& x ) const {
#ifdef CGAL_CFG_IEEE_754_BUG
#if defined CGAL_CFG_IEEE_754_BUG
Type d = x;
IEEE_754_double* p = reinterpret_cast<IEEE_754_double*>(&d);
return is_finite_by_mask_double( p->c.H );
#elif !defined CGAL_CFG_NO_CPP0X_ISFINITE
return std::isfinite(x);
#elif defined CGAL_CFG_NUMERIC_LIMITS_BUG
return (x == x) && (is_valid(x-x));
#else

View File

@ -119,10 +119,13 @@ public:
: public CGAL::unary_function< Type, bool > {
public:
bool operator()( const Type& x ) const {
#ifdef CGAL_CFG_IEEE_754_BUG
#if defined CGAL_CFG_IEEE_754_BUG
Type f = x;
IEEE_754_float* p = reinterpret_cast<IEEE_754_float*>(&f);
return is_finite_by_mask_float( p->c );
#elif !defined CGAL_CFG_NO_CPP0X_ISFINITE
return std::isfinite(x);
#else
return (x == x) && (is_valid(x-x));
#endif