Namespaces
Variants

isnormal

From cppreference.net
< c ‎ | numeric ‎ | math
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99) (C99) (C99) (C23)
Maximum/minimum operations
Exponential functions
Power functions
Trigonometric and hyperbolic functions
Nearest integer floating-point
(C99) (C99) (C99)
(C23) (C23) (C23) (C23)
Floating-point manipulation
Narrowing operations
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
Quantum and quantum exponent
Decimal re-encoding functions
Total order and payload functions
Classification
(C99)
(C99)
isnormal
(C99)
(C99)
(C23)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Types
Macro constants
Special floating-point values
Arguments and return values
Error handling
Fast operation indicators
Definiert im Header <math.h>
#define isnormal(arg) /* implementation defined */
(seit C99)

Bestimmt, ob die gegebene Gleitkommazahl arg normal ist, d.h. weder Null, subnormal, unendlich noch NaN ist. Das Makro gibt einen ganzzahligen Wert zurück.

FLT_EVAL_METHOD wird ignoriert: selbst wenn das Argument mit größerer Reichweite und Genauigkeit als sein Typ ausgewertet wird, wird es zuerst in seinen semantischen Typ konvertiert, und die Klassifizierung basiert darauf.

Inhaltsverzeichnis

Parameter

arg - Gleitkommawert

Rückgabewert

Nicht-Null-Ganzzahlwert, falls arg normal ist, 0 andernfalls.

Beispiel

#include <float.h>
#include <math.h>
#include <stdio.h>
int main(void)
{
    printf("isnormal(NAN)         = %d\n", isnormal(NAN));
    printf("isnormal(INFINITY)    = %d\n", isnormal(INFINITY));
    printf("isnormal(0.0)         = %d\n", isnormal(0.0));
    printf("isnormal(DBL_MIN/2.0) = %d\n", isnormal(DBL_MIN / 2.0));
    printf("isnormal(1.0)         = %d\n", isnormal(1.0));
}

Ausgabe:

isnormal(NAN)         = 0
isnormal(INFINITY)    = 0
isnormal(0.0)         = 0
isnormal(DBL_MIN/2.0) = 0
isnormal(1.0)         = 1

Referenzen

  • C23-Standard (ISO/IEC 9899:2024):
  • 7.12.3.5 Das isnormal-Makro (S.: TBD)
  • C17-Standard (ISO/IEC 9899:2018):
  • 7.12.3.5 The isnormal macro (p: TBD)
  • C11-Standard (ISO/IEC 9899:2011):
  • 7.12.3.5 Die isnormal-Makro (S: 237)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.12.3.5 Das isnormal-Makro (S: 217-218)

Siehe auch

klassifiziert den gegebenen Gleitkommawert
(Funktionsmakro)
prüft, ob die gegebene Zahl einen endlichen Wert hat
(Funktionsmakro)
(C99)
prüft, ob die gegebene Zahl unendlich ist
(Funktionsmakro)
(C99)
prüft, ob die gegebene Zahl NaN ist
(Funktionsmakro)
C++ documentation für isnormal