A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../numeric/../../c/language/../numeric/math/NAN.html below:

NAN - cppreference.com

#define NAN /*implementation defined*/

(since C99)

The macro NAN expands to a constant expression of type float, which evaluates to a quiet not-a-number (QNaN) value. If the implementation does not support QNaNs, this macro constant is not defined.

The style used to print a NaN is implementation-defined.

[edit] Notes

There are many different NaN values, differentiated by their payloads and their sign bits. The contents of the payload and the sign bit of the NaN generated by the macro NAN are implementation-defined.

[edit] Example

Show style used to print a NaN and IEEE format.

#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    const double f = NAN;
    uint64_t fn;
    memcpy(&fn, &f, sizeof f);
    printf("NAN:   %f %" PRIx64 "\n", f, fn);
}

Possible output:

NAN:   nan 7ff8000000000000
[edit] References
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4