Boost-Geometry-Utils

 view release on metacpan or  search on metacpan

src/boost/detail/limits.hpp  view on Meta::CPAN


  static __number epsilon() throw()     { return __number(); }
  static __number round_error() throw() { return __number(); }

  BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent,   0);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent,   0);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0);

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity,      false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN,     false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
                              has_denorm,
                              denorm_absent);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss,   false);

  static __number infinity() throw()      { return __number(); }
  static __number quiet_NaN() throw()     { return __number(); }
  static __number signaling_NaN() throw() { return __number(); }
  static __number denorm_min() throw()    { return __number(); }

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559,  false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo,  false);

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps,            false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before,  false);
  BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style,
                              round_style,

src/boost/detail/limits.hpp  view on Meta::CPAN

};

#endif

// Base class for floating-point numbers.
template <class __number,
         int __Digits, int __Digits10,
         int __MinExp, int __MaxExp,
         int __MinExp10, int __MaxExp10,
         unsigned int __InfinityWord,
         unsigned int __QNaNWord, unsigned int __SNaNWord,
         bool __IsIEC559,
         float_round_style __RoundStyle>
class _Floating_limits : public _Numeric_limits_base<__number>
{
public:
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);

  BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits,   __Digits);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10);

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true);

  BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2);

  BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent,   __MinExp);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent,   __MaxExp);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10);
  BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10);

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity,      true);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN,     true);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true);
  BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
                              has_denorm,
                              denorm_indeterminate);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss,   false);

 
  static __number infinity() throw() {
    return float_helper<__number, __InfinityWord>::get_word();
  }
  static __number quiet_NaN() throw() {
    return float_helper<__number,__QNaNWord>::get_word();
  }
  static __number signaling_NaN() throw() {
    return float_helper<__number,__SNaNWord>::get_word();
  }

  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559,       __IsIEC559);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded,      true);
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps,           false /* was: true */ );
  BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);

  BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle);
};

src/boost/detail/limits.hpp  view on Meta::CPAN

template<> class numeric_limits<float>
  : public _Floating_limits<float, 
                            FLT_MANT_DIG,   // Binary digits of precision
                            FLT_DIG,        // Decimal digits of precision
                            FLT_MIN_EXP,    // Minimum exponent
                            FLT_MAX_EXP,    // Maximum exponent
                            FLT_MIN_10_EXP, // Minimum base 10 exponent
                            FLT_MAX_10_EXP, // Maximum base 10 exponent
#if defined(BOOST_BIG_ENDIAN)
                            0x7f80 << (sizeof(int)*CHAR_BIT-16),    // Last word of +infinity
                            0x7f81 << (sizeof(int)*CHAR_BIT-16),    // Last word of quiet NaN
                            0x7fc1 << (sizeof(int)*CHAR_BIT-16),    // Last word of signaling NaN
#else
                            0x7f800000u,    // Last word of +infinity
                            0x7f810000u,    // Last word of quiet NaN
                            0x7fc10000u,    // Last word of signaling NaN
#endif
                            true,           // conforms to iec559
                            round_to_nearest>
{
public:
  static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; }
  static float denorm_min() throw() { return FLT_MIN; }
  static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; }
  static float epsilon() throw() { return FLT_EPSILON; }
  static float round_error() throw() { return 0.5f; } // Units: ulps.

src/boost/detail/limits.hpp  view on Meta::CPAN

template<> class numeric_limits<double>
  : public _Floating_limits<double, 
                            DBL_MANT_DIG,   // Binary digits of precision
                            DBL_DIG,        // Decimal digits of precision
                            DBL_MIN_EXP,    // Minimum exponent
                            DBL_MAX_EXP,    // Maximum exponent
                            DBL_MIN_10_EXP, // Minimum base 10 exponent
                            DBL_MAX_10_EXP, // Maximum base 10 exponent
#if defined(BOOST_BIG_ENDIAN)
                            0x7ff0 << (sizeof(int)*CHAR_BIT-16),    // Last word of +infinity
                            0x7ff1 << (sizeof(int)*CHAR_BIT-16),    // Last word of quiet NaN
                            0x7ff9 << (sizeof(int)*CHAR_BIT-16),    // Last word of signaling NaN
#else
                            0x7ff00000u,    // Last word of +infinity
                            0x7ff10000u,    // Last word of quiet NaN
                            0x7ff90000u,    // Last word of signaling NaN
#endif
                            true,           // conforms to iec559
                            round_to_nearest>
{
public:
  static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; }
  static double denorm_min() throw() { return DBL_MIN; }
  static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; }
  static double epsilon() throw() { return DBL_EPSILON; }
  static double round_error() throw() { return 0.5; } // Units: ulps.

src/boost/detail/limits.hpp  view on Meta::CPAN

template<> class numeric_limits<long double>
  : public _Floating_limits<long double, 
                            LDBL_MANT_DIG,  // Binary digits of precision
                            LDBL_DIG,       // Decimal digits of precision
                            LDBL_MIN_EXP,   // Minimum exponent
                            LDBL_MAX_EXP,   // Maximum exponent
                            LDBL_MIN_10_EXP,// Minimum base 10 exponent
                            LDBL_MAX_10_EXP,// Maximum base 10 exponent
#if defined(BOOST_BIG_ENDIAN)
                            0x7ff0 << (sizeof(int)*CHAR_BIT-16),    // Last word of +infinity
                            0x7ff1 << (sizeof(int)*CHAR_BIT-16),    // Last word of quiet NaN
                            0x7ff9 << (sizeof(int)*CHAR_BIT-16),    // Last word of signaling NaN
#else
                            0x7fff8000u,    // Last word of +infinity
                            0x7fffc000u,    // Last word of quiet NaN
                            0x7fff9000u,    // Last word of signaling NaN
#endif
                            false,          // Doesn't conform to iec559
                            round_to_nearest>
{
public:
  static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; }
  static long double denorm_min() throw() { return LDBL_MIN; }
  static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; }
  static long double epsilon() throw() { return LDBL_EPSILON; }
  static long double round_error() throw() { return 4; } // Units: ulps.

src/boost/lexical_cast.hpp  view on Meta::CPAN

    {
        template <class CharT>
        bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT {
            for( unsigned int i=0; i < len; ++i ) {
                if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false;
            }

            return true;
        }

        /* Returns true and sets the correct value if found NaN or Inf. */
        template <class CharT, class T>
        inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value
            , const CharT* lc_NAN, const CharT* lc_nan
            , const CharT* lc_INFINITY, const CharT* lc_infinity
            , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT
        {
            using namespace std;
            if (begin == end) return false;
            const CharT minus = lcast_char_constants<CharT>::minus;
            const CharT plus = lcast_char_constants<CharT>::plus;

src/boost/lexical_cast.hpp  view on Meta::CPAN

            if( lc_iequal(begin, lc_nan, lc_NAN, 3) )
            {
                begin += 3;
                if (end != begin) /* It is 'nan(...)' or some bad input*/
                {
                    if(end-begin<2) return false; // bad input
                    -- end;
                    if( *begin != opening_brace || *end != closing_brace) return false; // bad input
                }

                if( !has_minus ) value = std::numeric_limits<T>::quiet_NaN();
                else value = (boost::math::changesign) (std::numeric_limits<T>::quiet_NaN());
                return true;
            } else
            if (( /* 'INF' or 'inf' */
                  end-begin==3
                  &&
                  lc_iequal(begin, lc_infinity, lc_INFINITY, 3)
                )
                ||
                ( /* 'INFINITY' or 'infinity' */
                  end-begin==inifinity_size

src/boost/limits.hpp  view on Meta::CPAN

      BOOST_STATIC_CONSTANT(int, radix = 2);
      static BOOST_LLT epsilon() throw() { return 0; };
      static BOOST_LLT round_error() throw() { return 0; };

      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);

      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
      static BOOST_LLT infinity() throw() { return 0; };
      static BOOST_LLT quiet_NaN() throw() { return 0; };
      static BOOST_LLT signaling_NaN() throw() { return 0; };
      static BOOST_LLT denorm_min() throw() { return 0; };

      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
      BOOST_STATIC_CONSTANT(bool, is_bounded = true);
      BOOST_STATIC_CONSTANT(bool, is_modulo = true);

      BOOST_STATIC_CONSTANT(bool, traps = false);
      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
      

src/boost/limits.hpp  view on Meta::CPAN

      BOOST_STATIC_CONSTANT(int, radix = 2);
      static BOOST_ULLT epsilon() throw() { return 0; };
      static BOOST_ULLT round_error() throw() { return 0; };

      BOOST_STATIC_CONSTANT(int, min_exponent = 0);
      BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
      BOOST_STATIC_CONSTANT(int, max_exponent = 0);
      BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);

      BOOST_STATIC_CONSTANT(bool, has_infinity = false);
      BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
      BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
      BOOST_STATIC_CONSTANT(bool, has_denorm = false);
      BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
      static BOOST_ULLT infinity() throw() { return 0; };
      static BOOST_ULLT quiet_NaN() throw() { return 0; };
      static BOOST_ULLT signaling_NaN() throw() { return 0; };
      static BOOST_ULLT denorm_min() throw() { return 0; };

      BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
      BOOST_STATIC_CONSTANT(bool, is_bounded = true);
      BOOST_STATIC_CONSTANT(bool, is_modulo = true);

      BOOST_STATIC_CONSTANT(bool, traps = false);
      BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
      BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
      

src/boost/math/policies/error_handling.hpp  view on Meta::CPAN


template <class T>
inline T raise_domain_error(
           const char* function, 
           const char* message, 
           const T& val, 
           const ::boost::math::policies::domain_error< ::boost::math::policies::throw_on_error>&)
{
   raise_error<std::domain_error, T>(function, message, val);
   // we never get here:
   return std::numeric_limits<T>::quiet_NaN();
}

template <class T>
inline T raise_domain_error(
           const char* , 
           const char* , 
           const T& , 
           const ::boost::math::policies::domain_error< ::boost::math::policies::ignore_error>&)
{
   // This may or may not do the right thing, but the user asked for the error
   // to be ignored so here we go anyway:
   return std::numeric_limits<T>::quiet_NaN();
}

template <class T>
inline T raise_domain_error(
           const char* , 
           const char* , 
           const T& , 
           const ::boost::math::policies::domain_error< ::boost::math::policies::errno_on_error>&)
{
   errno = EDOM;
   // This may or may not do the right thing, but the user asked for the error
   // to be silent so here we go anyway:
   return std::numeric_limits<T>::quiet_NaN();
}

template <class T>
inline T raise_domain_error(
           const char* function, 
           const char* message, 
           const T& val, 
           const  ::boost::math::policies::domain_error< ::boost::math::policies::user_error>&)
{
   return user_domain_error(function, message, val);

src/boost/math/policies/error_handling.hpp  view on Meta::CPAN

template <class T, class R>
inline T raise_indeterminate_result_error(
           const char* function, 
           const char* message, 
           const T& val, 
           const R& ,
           const ::boost::math::policies::indeterminate_result_error< ::boost::math::policies::throw_on_error>&)
{
   raise_error<std::domain_error, T>(function, message, val);
   // we never get here:
   return std::numeric_limits<T>::quiet_NaN();
}

template <class T, class R>
inline T raise_indeterminate_result_error(
           const char* , 
           const char* , 
           const T& , 
           const R& result, 
           const ::boost::math::policies::indeterminate_result_error< ::boost::math::policies::ignore_error>&)
{

src/boost/math/special_functions/detail/bessel_ik.hpp  view on Meta::CPAN

    }
    if (x == 0)
    {
       Iv = (v == 0) ? static_cast<T>(1) : static_cast<T>(0);
       if(kind & need_k)
       {
         Kv = policies::raise_overflow_error<T>(function, 0, pol);
       }
       else
       {
          Kv = std::numeric_limits<T>::quiet_NaN(); // any value will do
       }

       if(reflect && (kind & need_i))
       {
           T z = (u + n % 2);
           Iv = boost::math::sin_pi(z, pol) == 0 ? 
               Iv : 
               policies::raise_overflow_error<T>(function, 0, pol);   // reflection formula
       }

src/boost/math/special_functions/detail/bessel_ik.hpp  view on Meta::CPAN

       {
          Iv = bessel_i_small_z_series(v, x, pol);
       }
       else
       {
          CF1_ik(v, x, &fv, pol);                         // continued fraction CF1_ik
          Iv = scale * W / (Kv * fv + Kv1);                  // Wronskian relation
       }
    }
    else
       Iv = std::numeric_limits<T>::quiet_NaN(); // any value will do

    if (reflect)
    {
        T z = (u + n % 2);
        T fact = (2 / pi<T>()) * (boost::math::sin_pi(z) * Kv);
        if(fact == 0)
           *I = Iv;
        else if(tools::max_value<T>() * scale < fact)
           *I = (org_kind & need_i) ? T(sign(fact) * sign(scale) * policies::raise_overflow_error<T>(function, 0, pol)) : T(0);
        else

src/boost/math/special_functions/detail/bessel_jy.hpp  view on Meta::CPAN

    }
    else if((x < 1) && (u != 0) && (log(policies::get_epsilon<T, Policy>() / 2) > v * log((x/2) * (x/2) / v)))
    {
       // Evaluate using series representations.
       // This is particularly important for x << v as in this
       // area temme_jy may be slow to converge, if it converges at all.
       // Requires x is not an integer.
       if(kind&need_j)
          Jv = bessel_j_small_z_series(v, x, pol);
       else
          Jv = std::numeric_limits<T>::quiet_NaN();
       if((org_kind&need_y && (!reflect || (cp != 0))) 
          || (org_kind & need_j && (reflect && (sp != 0))))
       {
          // Only calculate if we need it, and if the reflection formula will actually use it:
          Yv = bessel_y_small_z_series(v, x, &Yv_scale, pol);
       }
       else
          Yv = std::numeric_limits<T>::quiet_NaN();
    }
    else if((u == 0) && (x < policies::get_epsilon<T, Policy>()))
    {
       // Truncated series evaluation for small x and v an integer,
       // much quicker in this area than temme_jy below.
       if(kind&need_j)
          Jv = bessel_j_small_z_series(v, x, pol);
       else
          Jv = std::numeric_limits<T>::quiet_NaN();
       if((org_kind&need_y && (!reflect || (cp != 0))) 
          || (org_kind & need_j && (reflect && (sp != 0))))
       {
          // Only calculate if we need it, and if the reflection formula will actually use it:
          Yv = bessel_yn_small_z(n, x, &Yv_scale, pol);
       }
       else
          Yv = std::numeric_limits<T>::quiet_NaN();
    }
    else if (x <= 2)                           // x in (0, 2]
    {
        if(temme_jy(u, x, &Yu, &Yu1, pol))             // Temme series
        {
           // domain error:
           *J = *Y = Yu;
           return 1;
        }
        prev = Yu;

src/boost/math/special_functions/detail/bessel_jy.hpp  view on Meta::CPAN

            current = next;
        }
         Yv = prev;
         Yv1 = current;
         if(kind&need_j)
         {
            CF1_jy(v, x, &fv, &s, pol);                 // continued fraction CF1_jy
            Jv = scale * W / (Yv * fv - Yv1);           // Wronskian relation
         }
         else
            Jv = std::numeric_limits<T>::quiet_NaN(); // any value will do, we're not using it.
         Yv_scale = scale;
    }
    else                                    // x in (2, \infty)
    {
        // Get Y(u, x):
        // define tag type that will dispatch to right limits:
        typedef typename bessel_asymptotic_tag<T, Policy>::type tag_type;

        T lim, ratio;
        switch(kind)

src/boost/math/special_functions/detail/bessel_jy.hpp  view on Meta::CPAN

           break;
        }
        if(x > lim)
        {
           if(kind&need_y)
           {
              Yu = asymptotic_bessel_y_large_x_2(u, x);
              Yu1 = asymptotic_bessel_y_large_x_2(T(u + 1), x);
           }
           else
              Yu = std::numeric_limits<T>::quiet_NaN(); // any value will do, we're not using it.
           if(kind&need_j)
           {
              Jv = asymptotic_bessel_j_large_x_2(v, x);
           }
           else
              Jv = std::numeric_limits<T>::quiet_NaN(); // any value will do, we're not using it.
        }
        else
        {
           CF1_jy(v, x, &fv, &s, pol);
           // tiny initial value to prevent overflow
           T init = sqrt(tools::min_value<T>());
           prev = fv * s * init;
           current = s * init;
           if(v < max_factorial<T>::value)
           {

src/boost/math/special_functions/detail/bessel_jy.hpp  view on Meta::CPAN

                  current = next;
              }
              ratio = (s * init) / current;     // scaling ratio
              // can also call CF1_jy() to get fu, not much difference in precision
              fu = prev / current;
           }
           else
           {
              //
              // When v is large we may get overflow in this calculation
              // leading to NaN's and other nasty surprises:
              //
              bool over = false;
              for (k = n; k > 0; k--)             // backward recurrence for J
              {
                  T t = 2 * (u + k) / x;
                  if(tools::max_value<T>() / t < current)
                  {
                     over = true;
                     break;
                  }

src/boost/math/special_functions/detail/bessel_jy.hpp  view on Meta::CPAN

                  Yv_scale /= current;
                  current = 1;
               }
               next = fact * current - prev;
               prev = current;
               current = next;
           }
           Yv = prev;
        }
        else
           Yv = std::numeric_limits<T>::quiet_NaN(); // any value will do, we're not using it.
    }

    if (reflect)
    {
        if((sp != 0) && (tools::max_value<T>() * fabs(Yv_scale) < fabs(sp * Yv)))
           *J = org_kind & need_j ? T(-sign(sp) * sign(Yv) * sign(Yv_scale) * policies::raise_overflow_error<T>(function, 0, pol)) : T(0);
        else
            *J = cp * Jv - (sp == 0 ? T(0) : T((sp * Yv) / Yv_scale));     // reflection formula
        if((cp != 0) && (tools::max_value<T>() * fabs(Yv_scale) < fabs(cp * Yv)))
           *Y = org_kind & need_y ? T(-sign(cp) * sign(Yv) * sign(Yv_scale) * policies::raise_overflow_error<T>(function, 0, pol)) : T(0);

src/boost/math/special_functions/ellint_rf.hpp  view on Meta::CPAN

    BOOST_MATH_STD_USING
    using namespace boost::math::tools;

    static const char* function = "boost::math::ellint_rf<%1%>(%1%,%1%,%1%)";

    if (x < 0 || y < 0 || z < 0)
    {
       return policies::raise_domain_error<T>(function,
            "domain error, all arguments must be non-negative, "
            "only sensible result is %1%.",
            std::numeric_limits<T>::quiet_NaN(), pol);
    }
    if (x + y == 0 || y + z == 0 || z + x == 0)
    {
       return policies::raise_domain_error<T>(function,
            "domain error, at most one argument can be zero, "
            "only sensible result is %1%.",
            std::numeric_limits<T>::quiet_NaN(), pol);
    }

    // Carlson scales error as the 6th power of tolerance,
    // but this seems not to work for types larger than
    // 80-bit reals, this heuristic seems to work OK:
    if(policies::digits<T, Policy>() > 64)
    {
      tolerance = pow(tools::epsilon<T>(), T(1)/4.25f);
      BOOST_MATH_INSTRUMENT_VARIABLE(tolerance);
    }

src/boost/math/special_functions/ellint_rj.hpp  view on Meta::CPAN

    }
    if(p == 0)
    {
       return policies::raise_domain_error<T>(function,
            "Argument p must not be zero, but got p = %1%", p, pol);
    }
    if (x + y == 0 || y + z == 0 || z + x == 0)
    {
       return policies::raise_domain_error<T>(function,
            "At most one argument can be zero, "
            "only possible result is %1%.", std::numeric_limits<T>::quiet_NaN(), pol);
    }

    // error scales as the 6th power of tolerance
    tolerance = pow(T(1) * tools::epsilon<T>() / 3, T(1) / 6);

    // for p < 0, the integral is singular, return Cauchy principal value
    if (p < 0)
    {
       //
       // We must ensure that (z - y) * (y - x) is positive.

src/boost/math/special_functions/fpclassify.hpp  view on Meta::CPAN


#include <math.h>
#include <boost/config/no_tr1/cmath.hpp>
#include <boost/limits.hpp>
#include <boost/math/tools/real_cast.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/math/special_functions/math_fwd.hpp>
#include <boost/math/special_functions/detail/fp_traits.hpp>
/*!
  \file fpclassify.hpp
  \brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN.
  \version 1.0
  \author John Maddock
 */

/*

1. If the platform is C99 compliant, then the native floating point
classification functions are used.  However, note that we must only
define the functions which call std::fpclassify etc if that function
really does exist: otherwise a compiler may reject the code even though

src/boost/math/special_functions/fpclassify.hpp  view on Meta::CPAN


        This algorithm works for the IEEE 754 representation,
        and also for several non IEEE 754 formats.

    Most formats have the structure
        sign bit + exponent bits + significand bits.
    
    A few have the structure
        sign bit + exponent bits + flag bit + significand bits.
    The flag bit is 0 for zero and subnormal numbers,
        and 1 for normal numbers and NaN.
        It is 0 (Motorola 68K) or 1 (Intel) for infinity.

    To get the bits, the four or eight most significant bytes are copied
    into an uint32_t or uint64_t and bit masks are applied.
    This covers all the exponent bits and the flag bit (if there is one),
    but not always all the significand bits.
    Some of the functions below have two implementations,
    depending on whether all the significand bits are copied or not.

3. If the platform is not C99 compliant, and the binary format for

src/boost/math/special_functions/fpclassify.hpp  view on Meta::CPAN


        a &= traits::significand;
        traits::set_bits(x,a);
        return x != 0;
    }

}   // namespace detail

template<class T> 
inline bool (isnan)(T x)
{ //!< \brief return true if floating-point type t is NaN (Not A Number).
   typedef typename detail::fp_traits<T>::type traits;
   typedef typename traits::method method;
   typedef typename boost::is_floating_point<T>::type fp_tag;
   return detail::isnan_impl(x, method());
}

#ifdef isnan
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
template<> 
inline bool (isnan)(long double x)
{ //!< \brief return true if floating-point type t is NaN (Not A Number).
   typedef detail::fp_traits<long double>::type traits;
   typedef traits::method method;
   typedef boost::is_floating_point<long double>::type fp_tag;
   return detail::isnan_impl(x, method());
}
#endif

} // namespace math
} // namespace boost

src/boost/math/tools/workaround.hpp  view on Meta::CPAN


#ifdef _MSC_VER
#pragma once
#endif

#include <boost/math/tools/config.hpp>

namespace boost{ namespace math{ namespace tools{
//
// We call this short forwarding function so that we can work around a bug
// on Darwin that causes std::fmod to return a NaN.  The test case is:
// std::fmod(1185.0L, 1.5L);
//
template <class T>
inline T fmod_workaround(T a, T b)
{
   BOOST_MATH_STD_USING
   return fmod(a, b);
}
#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106))
template <>

src/boost/polygon/detail/voronoi_ctypes.hpp  view on Meta::CPAN

class extened_exponent_fpt_traits<fpt64> {
 public:
  typedef int exp_type;
  enum {
    MAX_SIGNIFICANT_EXP_DIF = 54
  };
};

// Floating point type wrapper. Allows to extend exponent boundaries to the
// integer type range. This class does not handle division by zero, subnormal
// numbers or NaNs.
template <typename _fpt, typename _traits = extened_exponent_fpt_traits<_fpt> >
class extended_exponent_fpt {
 public:
  typedef _fpt fpt_type;
  typedef typename _traits::exp_type exp_type;

  explicit extended_exponent_fpt(fpt_type val) {
    val_ = std::frexp(val, &exp_);
  }

src/ppport.h  view on Meta::CPAN

    s++; if (s == send || (*s != 'F' && *s != 'f')) return 0;
    s++; if (s < send && (*s == 'I' || *s == 'i')) {
      s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
      s++; if (s == send || (*s != 'I' && *s != 'i')) return 0;
      s++; if (s == send || (*s != 'T' && *s != 't')) return 0;
      s++; if (s == send || (*s != 'Y' && *s != 'y')) return 0;
      s++;
    }
    sawinf = 1;
  } else if (*s == 'N' || *s == 'n') {
    /* XXX TODO: There are signaling NaNs and quiet NaNs. */
    s++; if (s == send || (*s != 'A' && *s != 'a')) return 0;
    s++; if (s == send || (*s != 'N' && *s != 'n')) return 0;
    s++;
    sawnan = 1;
  } else
    return 0;

  if (sawinf) {
    numtype &= IS_NUMBER_NEG; /* Keep track of sign  */
    numtype |= IS_NUMBER_INFINITY | IS_NUMBER_NOT_INT;



( run in 0.301 second using v1.01-cache-2.11-cpan-4d50c553e7e )