Ticket #2877: bessel.patch

File bessel.patch, 616 bytes (added by John Maddock, 14 years ago)
  • bessel.hpp

     
    244244   if(v == 0.5f)
    245245   {
    246246      // common special case, note try and avoid overflow in exp(x):
    247       T e = exp(x / 2);
    248       return e * (e / sqrt(2 * x * constants::pi<T>()));
     247      if(x >= tools::log_max_value<T>())
     248      {
     249         T e = exp(x / 2);
     250         return e * (e / sqrt(2 * x * constants::pi<T>()));
     251      }
     252      return sqrt(2 / (x * constants::pi<T>())) * sinh(x);
    249253   }
    250254   if(policies::digits<T, Policy>() <= 64)
    251255   {