Namespaces
Variants

std:: isnormal

From cppreference.net
Common mathematical functions
Nearest integer floating point operations
(C++11)
(C++11)
(C++11) (C++11) (C++11)
Floating point manipulation functions
(C++11) (C++11)
(C++11)
(C++11)
Classification and comparison
(C++11)
(C++11)
(C++11)
(C++11)
isnormal
(C++11)
(C++11)
Types
(C++11)
(C++11)
(C++11)
Macro constants
Definiert im Header <cmath>
(1)
bool isnormal ( float num ) ;

bool isnormal ( double num ) ;

bool isnormal ( long double num ) ;
(seit C++11)
(bis C++23)
constexpr bool isnormal ( /*floating-point-type*/ num ) ;
(seit C++23)
SIMD-Überladung (seit C++26)
Definiert im Header <simd>
template < /*math-floating-point*/ V >

constexpr typename /*deduced-simd-t*/ < V > :: mask_type

isnormal ( const V & v_num ) ;
(S) (seit C++26)
Definiert im Header <cmath>
template < class Integer >
bool isnormal ( Integer num ) ;
(A) (seit C++11)
(constexpr seit C++23)
1) Bestimmt, ob die gegebene Gleitkommazahl num normal ist, d.h. weder Null, subnormal, unendlich noch NaN. Die Bibliothek bietet Überladungen für alle cv-unqualifizierten Gleitkommatypen als Typ des Parameters num an. (since C++23)
S) Die SIMD-Überladung führt eine elementweise std::isnormal auf v_num aus.
(Siehe math-floating-point und deduced-simd-t für deren Definitionen.)
(seit C++26)
A) Zusätzliche Überladungen werden für alle Ganzzahltypen bereitgestellt, die als double behandelt werden.

Inhaltsverzeichnis

Parameter

num - Gleitkomma- oder Ganzzahlwert
v_num - ein datenparalleles Objekt von std::basic_simd Spezialisierung, dessen Elementtyp ein Gleitkommatyp ist

Rückgabewert

1) true wenn num normal ist, false andernfalls.
S) Ein datenparalleles Maskenobjekt, bei dem das i te Element gleich true ist, wenn v_num [ i ] normal ist, oder false andernfalls, für alle i im Bereich [ 0 , v_num. size ( ) ) .

Hinweise

Die zusätzlichen Überladungen müssen nicht exakt wie (A) bereitgestellt werden. Sie müssen lediglich sicherstellen, dass für ihr Argument num vom Ganzzahltyp std :: isnormal ( num ) dieselbe Wirkung hat wie std :: isnormal ( static_cast < double > ( num ) ) .

Beispiel

#include <cfloat>
#include <cmath>
#include <iostream>
int main()
{
    std::cout << std::boolalpha
              << "isnormal(NaN) = " << std::isnormal(NAN) << '\n'
              << "isnormal(Inf) = " << std::isnormal(INFINITY) << '\n'
              << "isnormal(0.0) = " << std::isnormal(0.0) << '\n'
              << "isnormal(DBL_MIN/2.0) = " << std::isnormal(DBL_MIN / 2.0) << '\n'
              << "isnormal(1.0) = " << std::isnormal(1.0) << '\n';
}

Ausgabe:

isnormal(NaN) = false
isnormal(Inf) = false
isnormal(0.0) = false
isnormal(DBL_MIN/2.0) = false
isnormal(1.0) = true

Siehe auch

(C++11)
kategorisiert den angegebenen Gleitkommawert
(Funktion)
(C++11)
prüft, ob die angegebene Zahl einen endlichen Wert hat
(Funktion)
(C++11)
prüft, ob die angegebene Zahl unendlich ist
(Funktion)
(C++11)
prüft, ob die angegebene Zahl NaN ist
(Funktion)
C-Dokumentation für isnormal