<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[has_infinity()&#x2F; has_quiet_NaN()]]></title><description><![CDATA[<p>Hey Leute,</p>
<p>ich möchte mit den Funktionen &quot;isnotanumber&quot; und &quot;isinfinity&quot; überprüfen, ob die übergebenen Variablen &quot;x&quot; beziehungsweise &quot;y&quot; unendlich beziehungsweise nicht definiert sind.</p>
<p>Header:</p>
<p>&quot;#pragma once</p>
<p>#include &quot;targetver.h&quot;</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;tchar.h&gt;<br />
#include &quot;math.h&quot;<br />
#include &lt;cmath&gt;<br />
#include &lt;limits&gt;</p>
<p>int isinfinity(int x){<br />
int inf = numeric_limits&lt;int&gt;::has_infinity(x);<br />
return inf;<br />
}</p>
<p>int isnotanumber(int y){<br />
int nan = numeric_limits&lt;int&gt;::has_quiet_NaN(y);<br />
return nan;<br />
}&quot;</p>
<p>CPP-Datei:</p>
<p>&quot;#include &quot;stdafx.h&quot;<br />
#include &quot;math.h&quot;</p>
<p>#include &lt;limits&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;cstdio&gt;</p>
<p>using namespace std;</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
printf(&quot;isnan(0.0) : %d\n&quot;, isnotanumber(12));<br />
return 0;<br />
}&quot;</p>
<p>Der Compiler wirft folgende Fehler:</p>
<p>1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2065: 'numeric_limits': nichtdeklarierter Bezeichner<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2062: 'int'-Typ unerwartet<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2039: 'has_infinity': Ist kein Element von '<code>global namespace'' 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2065: 'numeric_limits': nichtdeklarierter Bezeichner 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2062: 'int'-Typ unerwartet 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2039: 'has\_quiet\_NaN': Ist kein Element von '</code>global namespace''<br />
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========</p>
<p>Was mache ich verkehrt? Vielen Dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/324509/has_infinity-has_quiet_nan</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 08:40:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/324509.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Mar 2014 20:26:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Wed, 19 Mar 2014 20:26:22 GMT]]></title><description><![CDATA[<p>Hey Leute,</p>
<p>ich möchte mit den Funktionen &quot;isnotanumber&quot; und &quot;isinfinity&quot; überprüfen, ob die übergebenen Variablen &quot;x&quot; beziehungsweise &quot;y&quot; unendlich beziehungsweise nicht definiert sind.</p>
<p>Header:</p>
<p>&quot;#pragma once</p>
<p>#include &quot;targetver.h&quot;</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;tchar.h&gt;<br />
#include &quot;math.h&quot;<br />
#include &lt;cmath&gt;<br />
#include &lt;limits&gt;</p>
<p>int isinfinity(int x){<br />
int inf = numeric_limits&lt;int&gt;::has_infinity(x);<br />
return inf;<br />
}</p>
<p>int isnotanumber(int y){<br />
int nan = numeric_limits&lt;int&gt;::has_quiet_NaN(y);<br />
return nan;<br />
}&quot;</p>
<p>CPP-Datei:</p>
<p>&quot;#include &quot;stdafx.h&quot;<br />
#include &quot;math.h&quot;</p>
<p>#include &lt;limits&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;cstdio&gt;</p>
<p>using namespace std;</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
printf(&quot;isnan(0.0) : %d\n&quot;, isnotanumber(12));<br />
return 0;<br />
}&quot;</p>
<p>Der Compiler wirft folgende Fehler:</p>
<p>1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2065: 'numeric_limits': nichtdeklarierter Bezeichner<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2062: 'int'-Typ unerwartet<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2039: 'has_infinity': Ist kein Element von '<code>global namespace'' 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2065: 'numeric_limits': nichtdeklarierter Bezeichner 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2062: 'int'-Typ unerwartet 1&gt;c:\\users\\hp\\documents\\visual studio 2010\\projects\\isnan\_test\\isnan\_test\\stdafx.h(23): error C2039: 'has\_quiet\_NaN': Ist kein Element von '</code>global namespace''<br />
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========</p>
<p>Was mache ich verkehrt? Vielen Dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389821</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389821</guid><dc:creator><![CDATA[C++Typ]]></dc:creator><pubDate>Wed, 19 Mar 2014 20:26:22 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Wed, 19 Mar 2014 20:31:12 GMT]]></title><description><![CDATA[<p>Du hast vergessen, <code>numeric_limits</code> mit <code>std::</code> zu qualifizieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389824</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389824</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 19 Mar 2014 20:31:12 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Wed, 19 Mar 2014 20:31:11 GMT]]></title><description><![CDATA[<p>using namespace std vergessen in den funktionen, bzw std::numeric_limits&lt;int&gt; schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389825</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389825</guid><dc:creator><![CDATA[Maxi]]></dc:creator><pubDate>Wed, 19 Mar 2014 20:31:11 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Wed, 19 Mar 2014 20:50:04 GMT]]></title><description><![CDATA[<p>Vielen Dank für eure schnelle Hilfe. Nachdem ich den Quellcode berichtigt habe, liefert der Compiler mir die Fehlermeldung:</p>
<p>&quot;1&gt;------ Erstellen gestartet: Projekt: Isnan_Test, Konfiguration: Debug Win32 ------<br />
1&gt; stdafx.cpp<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(18): error C2064: Ausdruck ergibt keine Funktion, die 1 Argumente übernimmt<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(23): error C2064: Ausdruck ergibt keine Funktion, die 1 Argumente übernimmt<br />
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========&quot;</p>
<p>Was ist verkehrt? Vielen Dank!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389832</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389832</guid><dc:creator><![CDATA[C++Typ]]></dc:creator><pubDate>Wed, 19 Mar 2014 20:50:04 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Wed, 19 Mar 2014 23:13:08 GMT]]></title><description><![CDATA[<p>Das liegt daran, dass du <code>numeric_limits</code> völlig falsch verwendest. <code>has_infinity</code> ist einfach ein statischer Member vom Typ <code>bool</code> , keine Funktion. Wenn du das haben möchtest, dann nimm<a href="http://en.cppreference.com/w/cpp/numeric/math/isinf" rel="nofollow"> <code>std::isinf</code> </a>und<a href="http://en.cppreference.com/w/cpp/numeric/math/isnan" rel="nofollow"> <code>std::isnan</code> </a>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389870</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389870</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Wed, 19 Mar 2014 23:13:08 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Thu, 20 Mar 2014 05:48:06 GMT]]></title><description><![CDATA[<p>Und bei <code>int</code> gibt's sowieso kein NaN/INF.<br />
=&gt; <code>return false;</code> tut's auch. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389894</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Thu, 20 Mar 2014 05:48:06 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Thu, 20 Mar 2014 09:03:59 GMT]]></title><description><![CDATA[<p>Hey Leute,</p>
<p>ich habe es mit Templates wie folgt versucht:</p>
<p>Header:<br />
&quot;#pragma once</p>
<p>#include &quot;targetver.h&quot;</p>
<p>#include &lt;stdio.h&gt;<br />
#include &lt;tchar.h&gt;<br />
#include &quot;math.h&quot;<br />
#include &lt;cmath&gt;<br />
#include &lt;limits&gt;</p>
<p>template &lt;class T&gt; bool isnan(T t);</p>
<p>template&lt;typename T&gt;<br />
inline bool isinf(T value)<br />
{<br />
return std::numeric_limits&lt;T&gt;::has_infinity() &amp;&amp;<br />
value == std::numeric_limits&lt;T&gt;::infinity();<br />
}</p>
<p>template&lt;typename T&gt;<br />
inline bool isnan(T value)<br />
{<br />
return value != value;<br />
}&quot;</p>
<p>CPP:<br />
&quot;#include &quot;stdafx.h&quot;<br />
#include &lt;cmath&gt;</p>
<p>#include &lt;limits&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;cstdio&gt;</p>
<p>using namespace std;</p>
<p>int _tmain(int argc, _TCHAR* argv[])<br />
{<br />
float nan = std::numeric_limits&lt;float&gt;::quiet_NaN();<br />
nan=0;<br />
float inf = std::numeric_limits&lt;float&gt;::infinity();<br />
std::cout &lt;&lt; nan &lt;&lt; '\n';<br />
std::cout &lt;&lt; inf &lt;&lt; '\n';<br />
printf(&quot;isnan(0.0) : %d\n&quot;, isnan(nan));<br />
printf(&quot;isnan(0.0) : %d\n&quot;, isinf(inf));<br />
return 0;<br />
}&quot;</p>
<p>Nun erhalte ich folgende Fehlermeldung für &quot;isinf&quot;:<br />
&quot;1&gt;------ Erstellen gestartet: Projekt: Isnan_Test, Konfiguration: Debug Win32 ------<br />
1&gt; stdafx.cpp<br />
1&gt; Isnan_Test.cpp<br />
1&gt;c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\stdafx.h(39): error C2064: Ausdruck ergibt keine Funktion, die 0 Argumente übernimmt<br />
1&gt; c:\users\hp\documents\visual studio 2010\projects\isnan_test\isnan_test\isnan_test.cpp(22): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template &quot;bool isinf&lt;float&gt;(T)&quot;.<br />
1&gt; with<br />
1&gt; [<br />
1&gt; T=float<br />
1&gt; ]<br />
========== Erstellen: 0 erfolgreich, Fehler bei 1, 0 aktuell, 0 übersprungen ==========&quot;</p>
<p>Was kann ich ändern? Vielen Dank für eure Hilfe!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389910</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389910</guid><dc:creator><![CDATA[C++Typ]]></dc:creator><pubDate>Thu, 20 Mar 2014 09:03:59 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Thu, 20 Mar 2014 09:19:08 GMT]]></title><description><![CDATA[<p>C++Typ schrieb:</p>
<blockquote>
<p>Was kann ich ändern?</p>
</blockquote>
<p>Du könntest mal in Deine Unterlagen zu C++ gucken, anstatt hier jede Iteration Deines Programms einzustellen.<br />
Dann kannst Du das plattformspezifische Gedöns weglassen ( <code>tchar.h, tmain</code> ), so dass jeder Deinen Quellcode kopieren, einfügen und kompilieren kann.<br />
Und drittens kannst Du Codetags verwenden (unter dem &quot;Nachrichtentext&quot;-Fenster).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389911</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389911</guid><dc:creator><![CDATA[Furble Wurble]]></dc:creator><pubDate>Thu, 20 Mar 2014 09:19:08 GMT</pubDate></item><item><title><![CDATA[Reply to has_infinity()&#x2F; has_quiet_NaN() on Thu, 20 Mar 2014 09:46:09 GMT]]></title><description><![CDATA[<p>Vielen Dank für höfliche Antworten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2389916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2389916</guid><dc:creator><![CDATA[C++Typ]]></dc:creator><pubDate>Thu, 20 Mar 2014 09:46:09 GMT</pubDate></item></channel></rss>