The issue with b and c both equal to 0 is in the line of code
xre[1] = c/(a*xre[0]);
The variable c equals zero in this case, and xre[0] also equals zero. So, you get 0/0 in that code, which leads to a so-called NaN. So, the special
case that both b and c are equal to zero must be handled separately, by simply setting both solutions to 0 and then returning from the solve-method..
|