nan function - C math.h

C examples for math.h:NAN

Type

function

From

<cmath>
<ctgmath>
<math.h>

Prototype

double nan (const char* tagp);

Description

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

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

Parameters

Parameter Description
tagp An implementation-specific C-string.

Return Value

A NaN value.

Demo Code


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

int main()//from   www .  j a va 2s.com
{
    printf("%f\n",nan(""));
    printf("%f",nan("NaN"));
    return 0;
}

Related Tutorials