namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:lib:isnan

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


kennen:lib:isnan [2019-11-20 15:41] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== isnan() ======
 +''#include'' [[..:include:cmath]]
 +
 +<code cpp>
 +bool isnan (double x)
 +</code>
 + Liefert ''true'', wenn ''x'' keine darstellbare Zahl ([[wpde>NaN]] = Not a Number) ist.
 +
 +==== Parameter ====
 +| ''zahl'' | Gleitkommazahl |
 +==== Ergebnis ====
 +Rückgabewert: ''true'' für Werte, 
 + die als Ergebnis von Operationen wie ''0.0/0.0'' oder $\infty - \infty$ entstehen.
 +
 +==== Siehe auch ====
 +[[isinf]],
 +[[isfinite]].
 +
 +==== Beispiel ====
 +<code cpp isnan.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>
  
kennen/lib/isnan.txt · Zuletzt geändert: 2019-11-20 15:41 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki