Namespaces
Variants

isunordered

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
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 in Header <math.h>
#define isunordered(x, y) /* implementation defined */
(seit C99)

Bestimmt, ob die Gleitkommazahlen x und y ungeordnet sind, das heißt, eine oder beide NaN sind und daher nicht sinnvoll miteinander verglichen werden können.

Inhaltsverzeichnis

Parameter

x - Gleitkommawert
y - Gleitkommawert

Rückgabewert

Ein von Null verschiedener ganzzahliger Wert, wenn entweder x oder y NaN ist, 0 andernfalls.

Beispiel

#include <math.h>
#include <stdio.h>
int main(void)
{
    printf("isunordered(NAN,1.0) = %d\n", isunordered(NAN, 1.0));
    printf("isunordered(1.0,NAN) = %d\n", isunordered(1.0, NAN));
    printf("isunordered(NAN,NAN) = %d\n", isunordered(NAN, NAN));
    printf("isunordered(1.0,0.0) = %d\n", isunordered(1.0, 0.0));
    return 0;
}

Mögliche Ausgabe:

isunordered(NAN,1.0) = 1
isunordered(1.0,NAN) = 1
isunordered(NAN,NAN) = 1
isunordered(1.0,0.0) = 0

Referenzen

  • C23-Standard (ISO/IEC 9899:2024):
  • 7.12.14.6 The isunordered macro (p: TBD)
  • F.10.11 Comparison macros (p: TBD)
  • C17-Standard (ISO/IEC 9899:2018):
  • 7.12.14.6 The isunordered macro (p: TBD)
  • F.10.11 Comparison macros (p: TBD)
  • C11-Standard (ISO/IEC 9899:2011):
  • 7.12.14.6 Die isunordered-Makro (S: 261)
  • F.10.11 Vergleichsmakros (S: 531)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.12.14.6 Die isunordered-Makro (S: 242)

Siehe auch

klassifiziert den gegebenen Gleitkommawert
(Funktionsmakro)
(C99)
prüft, ob die gegebene Zahl NaN ist
(Funktionsmakro)
C++-Dokumentation für isunordered