nanf - C math.h

C examples for math.h:nanf

Type

function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns a quiet NaN (Not-A-Number) value of type float.

The NaN values identifies undefined values for floating-point elements, such as the square root of negative numbers or the result of 0/0.

Prototype

float nanf (const char* tagp);

Parameters

Parameter Description
tagp An implementation-specific C-string.

Return Value

A quiet NaN value.

Demo Code


#include <stdio.h>
#include <math.h>

int main()/*from w ww  . j  a  va 2 s  .c om*/
{
    printf("%f\n",nanf(""));
    printf("%f",nanf("NaN"));
    return 0;
}

Related Tutorials