isnormal - C math.h

C examples for math.h:isnormal

type

macro/function

From

<cmath>
<ctgmath>
<math.h>

Description

Returns whether x is a normal value: i.e., whether it is neither infinity, NaN, zero or subnormal.

Prototype

bool isnormal (float x);
bool isnormal (double x);
bool isnormal (long double x);
     isnormal(x)

Parameters

Parameter Description
x A floating-point value.

Return value

A non-zero value (true) if x is normal; and zero (false) otherwise.

Example

Demo Code


#include <stdio.h>
#include <math.h> /* isnormal */

int main()//w  w w  .  java2  s  .  c o  m
{
  int a = 0;
  printf ("%d\n",isnormal(1.0));
  printf ("%d\n",isnormal(0.0));
  printf ("%d\n",isnormal(1.0/a));
  return 0;
}

Related Tutorials