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