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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top