本文共 1478 字,大约阅读时间需要 4 分钟。
nanl() function is a library function of cmath header, it is used to get the NaN value of type long double. It accepts an argument (which is an implementation-specific C String – to get NaN value we have to pass an empty string), it returns NaN value of type long double.
nanl()函数是cmath标头的库函数,用于获取long double类型的NaN值。 它接受一个参数(这是特定于实现的C字符串-要获取NaN值,我们必须传递一个空字符串),它返回long double类型的NaN值。
Not-A-Number (NaN) values are used to check whether the value is an unidentified/non-representable or not? For example, the square root of a negative number is unidentified.
非数字(NaN)值用于检查该值是否为未识别/不可代表? 例如,负数的平方根不确定。
Syntax of nanl() function:
nanl()函数的语法:
C++11:
C ++ 11:
long double nanl (const char* tagp);
Parameter(s):
参数:
tagp – represents an implementation-specific C-String.
tagp –表示特定于实现的C-String。
Return value:
返回值:
The return type of this method is long double, it returns NaN value.
此方法的返回类型为long double ,它返回NaN值。
Example:
例:
Function call: nanl(""); Output: nan
// C++ code to demonstrate the example of// nanl() function#include#include using namespace std;// main() sectionint main(){ float nanValue; //generating generic NaN value //by passing an empty string nanValue = nanl(""); //printing the value cout << "nanValue: " << nanValue << endl; return 0;}
Output
输出量
nanValue: nan
Reference:
参考:
翻译自:
转载地址:http://qcvzd.baihongyu.com/