您当前的位置: 首页 >  c++

phymat.nico

暂无认证

  • 2浏览

    0关注

    1967博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C++11判断inf, nan

phymat.nico 发布时间:2020-03-28 18:50:38 ,浏览量:2

参考链接: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 );  

关注
打赏
1659628745
查看更多评论
立即登录/注册

微信扫码登录

0.0647s