namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:lib:isnormal

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


kennen:lib:isnormal [2019-11-20 15:42] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== isnormal() ======
 +''#include'' [[..:include:cmath]]
 +
 +<code cpp>
 +bool isnormal (double x)
 +</code>
 + Liefert ''true'', wenn die Gleitkommazahl ''x'' normalisiert ist.
 +
 +==== Parameter ====
 +| ''zahl'' | Gleitkommazahl |
 +==== Ergebnis ====
 +Rückgabewert: ''true'', wenn ''zahl'' intern in der Form $(-1)^s\cdot 1.m\cdot 2^e$ [[wpde>Gleitkommazahl#Normalisierung|normalisiert]] dargestellt ist.
 +
 +==== Siehe auch ====
 +[[isfinite]].
 +
 +==== Beispiel ====
 +<code cpp isnormal.cpp>
 +#include <cmath>
 +#include <iostream>
 +
 +void properties(double x)
 +{
 +  std::cout << std::isnormal(x) << '\t'
 +            << std::isfinite(x) << '\t'
 +            << std::isinf(x) << '\t'
 +            << std::isnan(x) << '\t'
 +            << !std::isunordered(x,x) << '\t'
 +            << std::signbit(x) << '\t'
 + << x << '\n';
 +}
 +
 +int main()
 +{
 +  std::cout << std::boolalpha
 +            << "normal\tfinite\tinf\tNaN\tordered\tsignbit\tx\n\n";
 +
 +  properties(0.0);
 +  properties(1.0);
 +  properties(1.0/0.0);
 +  properties(0.0/0.0);
 +
 +  properties(-0.0);
 +  properties(-1.0);
 +  properties(-1.0/0.0);
 +  properties(-0.0/0.0);
 +
 +  properties(HUGE_VAL);
 +  properties(INFINITY);
 +  properties(NAN);
 +}
 +</code>
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki