I have read about floating-point and I understand that NaN could result from operations. But I can't understand what these are concepts exactly. What is the difference between them?
Which one can be produced during C++ programming? As a programmer, could I write a program that causes an sNaN?
When an operation results in a quiet NaN, there is no indication that anything is unusual until the program checks the result and sees a NaN. That is, computation continues without any signal from the floating point unit (FPU) or library if floating-point is implemented in software. A signalling NaN will produce a signal, usually in the form of exception from the FPU. Whether the exception is thrown depends on the state of the FPU.
C++11 adds a few language controls over the floating-point environment and provides standardized ways to create and test for NaNs. However, whether the controls are implemented is not well standardized and floating-point exceptions are not typically caught the same way as standard C++ exceptions.
In POSIX/Unix systems, floating point exceptions are typically caught using a handler for SIGFPE.