Rate This Document
Findability
Accuracy
Completeness
Readability

nan

Return the floating point NaN of the input string.

Interface Definition

C interface:

float nanf(const char *tagp);

double nan(const char *tagp);

Parameters

Parameter

Type

Description

Input/Output

tagp

  • For nanf, tagp is of string pointer type.
  • For nan, tagp is of string pointer type.

Input data.

Input

Return Value

If tagp is not NULL, floating-point NaN is returned. If tagp is NULL, undefined behavior occurs. Ensure that the input parameter is not NULL.

Dependency

C: "km.h"

Example

C interface:

// typical usage
const char *a = "0x7ff8000000000000";
const char *b = "0x781";
const char *c = "0x781asdf";
printf("/*\n");
printf(" * nan(%s)=0x%lx\n", a, Asuint64(nan(a)));
printf(" * nan(%s)=0x%lx\n", b, Asuint64(nan(b)));
printf(" * nan(%s)=0x%lx\n", c, Asuint64(nan(c)));
printf(" **/\n");
/*
 * nan(0x7ff8000000000000)=0x7ff8000000000000
 * nan(0x781)=0x7ff8000000000781
 * nan(0x781asdf)=0x7ff8000000000000
 **/