I would like to start posting a few C++ code snippets and thought I would start with something well-known and simple: a Quadratic Equation Solver.
I am trying to be as thorough as possible, so am also considering the possibility that a non-quadratic equation might be fed into the sub-routine.
For example, my sub-routine accepts the coefficients a, b, and c as per the standard form: ax^2 + bx + c = 0
To handle the case where a = 0 is input into the routine, I have left the components of one root unassigned. I was hoping that the output results would be something like 0xABB or some other gibberish, to highlight the fact that only one root exists, the other does NOT. However, I notice after testing the program with a = 0, the non-existent root is output as 9.25596313493178e+061. Most people would realize this is a non-answer, but I would like something that stands out more blatantly.
So I am considering using quiet_NaN. Is this acceptable practice? Or is there a better way someone can recommend?