首页 > 编程知识 正文

isnan函数matlab,matlab中int2str函数

时间:2023-05-04 17:12:25 阅读:135682 作者:3236

isnan函数c语言

C isnan (函数(C isnan )、函数(function )、函数(isnan )、函数(functionisalibraryfunctionofcmathhheader )、 itisusedtocheckwhetherthegivenvalueisanan (not-a-number ).itacceptsavalue (float,double or long double ) and return S1 ift

isNaN ) )函数是cmath标头的库函数,用于检查指定的值是否为nan (非数值)。 接受值(float、double或long double ),如果给定值为NaN,则返回1。 否则,回到1。 0,否则。

syntaxofisnan (函数:

isnan ) )函数语法:

In C99,it has been implemented as a macro,

在C99中,它被实现为宏。

macroisnan(x ) In C 11,ithasbeenimplementedasafunction,

在C 11中,它被实现为函数

boolisnan(floatx ); boolisnan(doublex ); boolisnan(longdoublex ); 参数(s ) :

参数:

xrepresentsavaluetobecheckedasanan。

x表示要作为nan检查的值。

返回值:

返回值:

thereturnstypeofthisfunctionisbool,it returns 1 if the x is NaN; 0,otherwise

此函数的返回类型为bool,如果x为NaN,则返回1; 否则,回到1。 0,否则。

Example:

示例:

Input: float x=0.0f/0.0f; functioncall:Isnan(x; output :1 input : floatx=sqrt (-1.0f; functioncall:Isnan(x; 输出:1输入3360 floatx=10.0 f; functioncall:Isnan(x; Output: 0 C代码演示isnan (函数示例) ccodetodemonstratetheexampleofisnan ) (函数)/ccodetodemonstratetheexampleof/isnan fun int main () cout'isnan ) sqrt(-10.0f ) ) :'isnan ) sqrt(-10.0f ) ) endl; cout'Isnan(0.0f/0.0f ) :'Isnan ) 0.0f/0.0f ) endl; cout'Isnan(0.0f/1.0f ) :'Isnan ) 0.0f/1.0f ) endl; cout'Isnan(1.0f/0.0f ) :'Isnan ) 1.0f/0.0f ) endl; floatx=sqrt(-1.0f; //checkingusingtheconditionif (isnan ) x ) { cout x ' is a NaN.' endl; } else { cout x ' is not a NaN.' endl; }x=sqrt(2; if(Isnan(x ) ) { cout x ' is a NaN.' endl; } else { cout x ' is not a NaN.' endl; } return 0; } Output

出口量

isnan(sqrt(10.0f ) ) :1isnan ) 0.0f/0.0f ) ) :1isnan ) 0.0f/1.0f ) :isnan ) 1.0f/0.0 f ) ) 333:

参考: C isnan ()函数

3:https://www.include help.com/CPP-tutorial/isnan-function-with-example.aspx翻译

isnan函数c语言

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。