On this page
  1. isnan
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

isnan

Prev: floor | Up: math.h | Next: time.h
Rel: math.h, math, time & assert Guide
Ref: cppreference — isnan
Tags: #public #prog #c #stdlib #math #tier/core


Include

#include <math.h>

Signature & Overview

bool isnan(floating x);  /* also isinf, isfinite */

Type-generic macro returning non-zero if x is NaN (x == x is always false for NaN).

Notes & Pitfalls

Example

#include <assert.h>
#include <math.h>

int main(void) {
    double x = NAN;
    assert(isnan(x) && !(x == x));
}

Linked from

Related notes