C++11判断inf, nan
生活随笔
收集整理的這篇文章主要介紹了
C++11判断inf, nan
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
參考鏈接:http://en.cppreference.com/w/cpp/numeric/math/isinf
程序中碰到nan卻找不到哪里出錯是最讓人頭疼的問題之一,最近在cppreference上找到相關的庫函數可以對異常狀態進行判斷。
判斷inf
如果是inf則返回true, 其他情況(包括nan)返回false
bool isinf( float arg );
bool isinf( double arg );
bool isinf( long double arg );
bool isinf( Integral arg );
如果是有限數返回true,其他情況(包括nan)返回false
bool isfinite( float arg );
bool isfinite( double arg );
bool isfinite( long double arg );
bool isfinite( Integral arg );
判斷nan
bool isnan( float arg );
bool isnan( double arg );
bool isnan( long double arg );
bool isnan( Integral arg );
?
總結
以上是生活随笔為你收集整理的C++11判断inf, nan的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: PCL点云曲面重采样三种方法:上采样,下
- 下一篇: matlab保存figure图像中所有的