NaN- Not a number is one such night mare that can cripple your entire Code , your hours (Or even Minutes 😉 ) of punching the keyboard , that almost teases your patience of debugging the program
Only oneTIP for this : How certain you are about your code and how perfect is your code analysis and Data flow is ,
Just Check for Division By Zero Evaluation!
In any Division Arithmeticity Do check this , keep it as a habit and it should just flow when you are busy in such Divisional Logics in your code
The dirty way is to add a very small (negligible) padding to your denominator , Sure you woudnt do that if your coding for a Nuke Reactor or NASA JPL Mars Program 😉