


I've also searched online for examples so I am aware of the presence of a library that does this for me, but that defeats the purpose of the assignment. I've traced out the input that I can by pausing after execution and I noticed after about the 5th iteration that my program calculates an incorrect value (-67 instead of 40) but I'm confused why this happens, especially since it works initially. My implementation goes on infinitely despite the fact my condition, which is when the r-th summation value is less than some epsilon (the do-while code), mathematically should eventually fail (because as n approaches infinity, n!(n+1)! > (x/2)^n). The equation is as follows: (sorry don't have enough reputation to post a photo). So as an assignment I was given the task to write a function that when given an x, calculates the corresponding first order Bessel function from it.
