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点云曲面重采样三种方法:上采样,下
- 下一篇: vc++ 利用jmail组件收发邮件