A RetroSearch Logo

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

Search Query:

Showing content from https://cplusplus.com/reference/cmath/isnormal/ below:

macro/function

<cmath> <ctgmath>

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

Is normal

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

In C, this is implemented as a macro that returns an int value. The type of x shall be float, double or long double.

In C++, it is implemented with function overloads for each

floating-point type

, each returning a

bool

value.



Parameters
x
A floating-point value.

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

Example
1
2
3
4
5
6
7
8
9
10
11
/* isnormal example */
#include <stdio.h>      /* printf */
#include <math.h>       /* isnormal */

int main()
{
  printf ("isnormal(1.0)    : %d\n",isnormal(1.0));
  printf ("isnormal(0.0)    : %d\n",isnormal(0.0));
  printf ("isnormal(1.0/0.0): %d\n",isnormal(1.0/0.0));
  return 0;
}

Output:
isnormal(1.0)    : 1
isnormal(0.0)    : 0
isnormal(1.0/0.0): 0


See also
isfinite
Is finite value (macro)
isinf
Is infinity (macro/function)
isnan
Is Not-A-Number (macro/function)
fpclassify
Classify floating-point value (macro/function)

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