Bad idea. NaN and −1 are totally different objects. Learn to use NaN and Inf. There are designed for real productive use, not to give you some useless hassles.
If you use −1 as a "lack of number" or "uninitialized number", you loose the ability to use it as a valid number, which is what it is. That would be the worse you could do.
Don't invent what is already invented, standardized and justified by huge volume of malpractice. The massive malpractice of using −1, 0, or other inappropriate objects as "not numbers" cannot justify anything. Moreover, such malpractice already caused a lot of mess up and bugs.
Instead, use to learn NaN and Inf. They can participate in calculations; they can be assigned to aa floating-point object, checked up, and so on. Inf can even be used in numeric expressions and give correct results. In particular, you can divide by zero and obtain infinity, which can further be used in calculations.
Please see:
Floating point — Wikipedia, the free encyclopedia[
^],
IEEE floating point — Wikipedia, the free encyclopedia[
^],
NaN — Wikipedia, the free encyclopedia[
^].
In C++:
nan — C++ Reference[
^],
NAN — C++ Reference[
^],
isnan — C++ Reference[
^];
isinf — C++ Reference[
^],
isfinite — C++ Reference[
^],
isnormal — C++ Reference[
^],
isfinite — C++ Reference[
^].
—SA