What is difference between quiet NaN and signaling NaN?

I have read about floating-point and I understand that NaN could results from operations. but I can't understand what are these concepts exactly. What is difference?

Which one can be produced during C++ programming? As a programmer, could I write a program cause a 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.

链接地址: http://www.djcxy.com/p/58496.html

上一篇: 如何检查Pandas DataFrame中的任何值是否为NaN

下一篇: 安静的NaN和信号NaN有什么区别?