Mean longitude error(?)

Problem(?) with this algorithm:
- I found that sometimes the result of omega and/or mean longitude is "nan" and I'm not sure why [maybe in hyperbolic case or when the arbitrary case which one of the e0, e1, or e2 give a "nan" value]
- if the orbit is circular (in this case e<=1.e-10) it should be that Omega=0, omega=0 and true anomaly or mean anomaly = mean longitude, but in this algorithm it will give all 0.0 for Omega, omega, l, and f (?)