Question

I have checked the boost docs, and I understand that this error is the result of passing 0 as the second argument to boost::math::cyl_bessel_k, and it does

  return (v == 0) ? policies::raise_overflow_error<T>(function, 0, pol)
     : policies::raise_domain_error<T>(
     function,
     "Got x = %1%, but we need x > 0", x, pol);

if it receives it.

I'm 98% c++ noob. How can this error be handled to prevent my program from crashing?

Était-ce utile?

La solution

Well the obvious answer seems to be to not pass 0, but if that is not feasible, and you are ok with the function failing, you can catch the exception and handle it in a way that seems right. The program wont crash then.

This tutorial might help explain deeper what you should do.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top