<?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[double = NAN, obwohl ich nirgends durch NULL teilen kann?!]]></title><description><![CDATA[<p>ich bekomme ein ganz merkwürdige ausgabe im programm, und frage mich wie dieser fehler auftreten kann, wenn eine division ausgeschlossen ist.<br />
außerdem verschwindet der fehler wenn ich die ausgabe wiederhole... mir fällt irgendwie nicht ein, warum sowas auftreten könnte!</p>
<pre><code>TEST-Ausgabe: 0
Ausgabeneuron 0 = 9.55705e-05
Ausgabeneuron 1 = 4.47981e-07
Ausgabeneuron 2 = 0.0245569
Ausgabeneuron 3 = 2.88943e-09
Ausgabeneuron 4 = 4.79755e-10
Ausgabeneuron 5 = 8.67928e-05
Ausgabeneuron 6 = 1.489e-05
Ausgabeneuron 7 = 0.0321845
Ausgabeneuron 8 = 1.11353e-05
Ausgabeneuron 9 = 0.994252
TEST-Ausgabe: 1
Ausgabeneuron 0 = nan
Ausgabeneuron 1 = nan
Ausgabeneuron 2 = nan
Ausgabeneuron 3 = nan
Ausgabeneuron 4 = nan
Ausgabeneuron 5 = nan
Ausgabeneuron 6 = nan
Ausgabeneuron 7 = nan
Ausgabeneuron 8 = nan
Ausgabeneuron 9 = nan

Wiederholung:
TEST-Ausgabe: 0
Ausgabeneuron 0 = 9.77298e-05
Ausgabeneuron 1 = 4.36772e-07
Ausgabeneuron 2 = 0.0251543
Ausgabeneuron 3 = 2.83783e-09
Ausgabeneuron 4 = 4.69154e-10
Ausgabeneuron 5 = 8.5453e-05
Ausgabeneuron 6 = 1.51131e-05
Ausgabeneuron 7 = 0.0315974
Ausgabeneuron 8 = 1.09645e-05
Ausgabeneuron 9 = 0.994419
TEST-Ausgabe: 1
Ausgabeneuron 0 = 0.989671
Ausgabeneuron 1 = 7.99327e-06
Ausgabeneuron 2 = 0.000325618
Ausgabeneuron 3 = 0.000418063
Ausgabeneuron 4 = 0.00302999
Ausgabeneuron 5 = 0.000308444
Ausgabeneuron 6 = 2.53812e-05
Ausgabeneuron 7 = 5.20772e-10
Ausgabeneuron 8 = 2.95479e-10
Ausgabeneuron 9 = 0.000717555
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/212569/double-nan-obwohl-ich-nirgends-durch-null-teilen-kann</link><generator>RSS for Node</generator><lastBuildDate>Wed, 14 Oct 2026 20:28:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/212569.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 07 May 2008 20:08:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Wed, 07 May 2008 20:08:49 GMT]]></title><description><![CDATA[<p>ich bekomme ein ganz merkwürdige ausgabe im programm, und frage mich wie dieser fehler auftreten kann, wenn eine division ausgeschlossen ist.<br />
außerdem verschwindet der fehler wenn ich die ausgabe wiederhole... mir fällt irgendwie nicht ein, warum sowas auftreten könnte!</p>
<pre><code>TEST-Ausgabe: 0
Ausgabeneuron 0 = 9.55705e-05
Ausgabeneuron 1 = 4.47981e-07
Ausgabeneuron 2 = 0.0245569
Ausgabeneuron 3 = 2.88943e-09
Ausgabeneuron 4 = 4.79755e-10
Ausgabeneuron 5 = 8.67928e-05
Ausgabeneuron 6 = 1.489e-05
Ausgabeneuron 7 = 0.0321845
Ausgabeneuron 8 = 1.11353e-05
Ausgabeneuron 9 = 0.994252
TEST-Ausgabe: 1
Ausgabeneuron 0 = nan
Ausgabeneuron 1 = nan
Ausgabeneuron 2 = nan
Ausgabeneuron 3 = nan
Ausgabeneuron 4 = nan
Ausgabeneuron 5 = nan
Ausgabeneuron 6 = nan
Ausgabeneuron 7 = nan
Ausgabeneuron 8 = nan
Ausgabeneuron 9 = nan

Wiederholung:
TEST-Ausgabe: 0
Ausgabeneuron 0 = 9.77298e-05
Ausgabeneuron 1 = 4.36772e-07
Ausgabeneuron 2 = 0.0251543
Ausgabeneuron 3 = 2.83783e-09
Ausgabeneuron 4 = 4.69154e-10
Ausgabeneuron 5 = 8.5453e-05
Ausgabeneuron 6 = 1.51131e-05
Ausgabeneuron 7 = 0.0315974
Ausgabeneuron 8 = 1.09645e-05
Ausgabeneuron 9 = 0.994419
TEST-Ausgabe: 1
Ausgabeneuron 0 = 0.989671
Ausgabeneuron 1 = 7.99327e-06
Ausgabeneuron 2 = 0.000325618
Ausgabeneuron 3 = 0.000418063
Ausgabeneuron 4 = 0.00302999
Ausgabeneuron 5 = 0.000308444
Ausgabeneuron 6 = 2.53812e-05
Ausgabeneuron 7 = 5.20772e-10
Ausgabeneuron 8 = 2.95479e-10
Ausgabeneuron 9 = 0.000717555
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1505151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505151</guid><dc:creator><![CDATA[dgrat]]></dc:creator><pubDate>Wed, 07 May 2008 20:08:49 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Wed, 07 May 2008 20:11:05 GMT]]></title><description><![CDATA[<p>ich denke mal es wird dort Indizies uberschreitungen geben oder sowas.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505154</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505154</guid><dc:creator><![CDATA[Firefighter]]></dc:creator><pubDate>Wed, 07 May 2008 20:11:05 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Wed, 07 May 2008 20:14:45 GMT]]></title><description><![CDATA[<p>ich werde das mal überprüfen, aber theoretisch dürfte es keine geben...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505159</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505159</guid><dc:creator><![CDATA[dgrat]]></dc:creator><pubDate>Wed, 07 May 2008 20:14:45 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Wed, 07 May 2008 20:35:04 GMT]]></title><description><![CDATA[<p>ich glaube, NAN tritt auch auf, wenn die Zahl zu groß wird (also 1/0.0000000000001) oder so was. Bin mir aber nicht sicher.</p>
<p>Dass sich die Ausgabe jedesmal ändert, könnte an einer nicht initialisierten Variablen liegen (9.55705e-05 --&gt; 9.77298e-05).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505168</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505168</guid><dc:creator><![CDATA[Gugi]]></dc:creator><pubDate>Wed, 07 May 2008 20:35:04 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Wed, 07 May 2008 20:50:23 GMT]]></title><description><![CDATA[<p>es gibt keine zugriffe auf nicht allokierte indices!</p>
<pre><code>BERECHNUNG von NEURON in Schicht: 2; Pos=8 aus:
        Neuron: Schicht=1; Pos=0 ;Wert=0.853248
        Axon: Schicht=1; Neuron=0 ;Pos=8 ;Wert=-2.55708
WERT: nan
</code></pre>
<p>der fehler tritt zb beim multiplizieren der beiden werte auf... das kann doch nicht sein!!</p>
<p>ich habe hier mal nen testfall geschaffen..</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505173</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505173</guid><dc:creator><![CDATA[dgrat]]></dc:creator><pubDate>Wed, 07 May 2008 20:50:23 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Thu, 08 May 2008 01:26:27 GMT]]></title><description><![CDATA[<p>ja zeich mal den testfall, oder sollen wir hier raten?<br />
oder hoffst du auf hellsichtige?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505207</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505207</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Thu, 08 May 2008 01:26:27 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Thu, 08 May 2008 06:43:34 GMT]]></title><description><![CDATA[<p>Gugi schrieb:</p>
<blockquote>
<p>ich glaube, NAN tritt auch auf, wenn die Zahl zu groß wird (also 1/0.0000000000001) oder so was. Bin mir aber nicht sicher.</p>
<p>Dass sich die Ausgabe jedesmal ändert, könnte an einer nicht initialisierten Variablen liegen (9.55705e-05 --&gt; 9.77298e-05).</p>
</blockquote>
<p>Ne, das gibt höchstens Inf. NaN gibts bei 0/0 oder wenn Müll im Speicher steht der keinem gültigen IEEE-Float/Double-Wert entspricht, z.B. durch nicht initialisierte Variablen. Außerdem gibts immer wieder NaN, wenn man mathematische Operationen mit NaN durchführt. Also z.B. NaN * Zahl.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505246</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505246</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 08 May 2008 06:43:34 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Thu, 08 May 2008 07:30:20 GMT]]></title><description><![CDATA[<p>ok, ich versuche mal möglichst ordentlich den code zu posten:</p>
<p>hier wird speicher angefordert...</p>
<pre><code class="language-cpp">n_of_layers = nmb_of_layers;
	n_of_neurons = nmb_of_neurons;
	n_of_axons = nmb_of_axons;

	//! erzeuge Layer
	n_annet = new layer* [nmb_of_layers];
	for(int i = 0; i &lt; nmb_of_layers; i++) {
		n_annet[i] = new layer(i, nmb_of_neurons[i], nmb_of_axons[i] );
	}

	//! Verknüpfe die Layer untereinander UND
	//! fülle Layer mit Zufallszahlen
	for(int i = 0; i &lt; nmb_of_layers; i++) {

		//! fülle neurone mit zufallszahlen
		for(int j = 0; j &lt; n_annet[i]-&gt;size_of_layer(); j++) {
			n_annet[i]-&gt;getNeuAt(j)-&gt;setNeuVal(get_rand_nmb(1, 4));

			//! fülle axone mit zufallszahlen
			for(int k = 0; k &lt; n_annet[i]-&gt;getNeuAt(j)-&gt;nmb_of_axons(); k++) {
				n_annet[i]-&gt;getNeuAt(j)-&gt;setAxVal(get_rand_nmb(1, 4), k);

				//! Verknüpfung
				axon *curAxon = n_annet[i]-&gt;getNeuAt(j)-&gt;getAxon(k);
				curAxon-&gt;setOwner(n_annet[i]-&gt;getNeuAt(j) );
				// bin noch im vorlestzen Layer, 
				// damit verknüpfung zum nächsten Layer noch möglich ist
				if(i &lt; nmb_of_layers - 1)
					// i + 1 ist der nächste Layer und k entspricht dem k'ten Neuron
					curAxon-&gt;setDest(n_annet[i+1]-&gt;getNeuAt(k) );
			}
		}
	}
</code></pre>
<p>das ist die lauffunktion mit ausgabe:</p>
<pre><code class="language-cpp">float *annet::run_annet(float *eingabe, bool ausgabe) {
	float *nextLayerNeurVal;

	if(eingabe != NULL)
		for(int j = 0; j &lt; n_annet[0]-&gt;size_of_layer(); j++) {
			n_annet[0]-&gt;getNeuAt(j)-&gt;setNeuVal(eingabe[j]);
		}

	/*! durchlaufe das netz*/
	for(int i = 0; i &lt; n_of_layers; i++) {
		//! Anzahl der Axone pro Neuron entspr. der Neuronzahl im nächsten Layer
		int neurNextLayer = n_annet[i]-&gt;getAxonPNeu();

		//! array mit den errechneten werten der neurone für die nächste schicht
		nextLayerNeurVal = new float[neurNextLayer];

		/*!
			Durchlaufe die einzelnen Schichten nacheinander und ausgehend von der Ersten.
			Erste Schicht ist die Eingabeschicht (immer).
		*/

		/*!
			Lauffunktion:
			=SUMME(Neuron*Axon_i) = Neuron_i; 

			i = schicht im netz
			j = neuron in schicht i
			k = axon von neuron j in schicht i
		*/
		for(int k = 0; k &lt; neurNextLayer; k++) {
			memset(nextLayerNeurVal, 0, neurNextLayer);
			for(int j = 0; j &lt; n_annet[i]-&gt;size_of_layer(); j++) {
// 				std::cout&lt;&lt;i&lt;&lt;&quot; - &quot;&lt;&lt;j&lt;&lt;&quot; - &quot;&lt;&lt;k&lt;&lt;std::endl;

				// val_cur_neur ist das aktuelle neuron
				long double val_cur_neur = n_annet[i]-&gt;getNeuAt(j)-&gt;getNeuVal();
				// axon nr. k von neuron: val_cur_neur
				long double axon_cur_neur = n_annet[i]-&gt;getNeuAt(j)-&gt;getAxVal(k);

				// Berechnung
				nextLayerNeurVal[k] += val_cur_neur * axon_cur_neur;

				/*!
					ausgabe-test
				*/
				if(ausgabe) {
					std::cout&lt;&lt;&quot;BERECHNUNG von NEURON in Schicht: &quot;&lt;&lt;i+1&lt;&lt;&quot;; Pos=&quot;&lt;&lt;k&lt;&lt;&quot; aus:&quot;&lt;&lt;std::endl&lt;&lt;
					&quot;	Neuron: Schicht=&quot;&lt;&lt;i&lt;&lt;&quot;; Pos=&quot;&lt;&lt;j&lt;&lt;&quot; ;Wert=&quot;&lt;&lt;val_cur_neur&lt;&lt;std::endl&lt;&lt;
					&quot;	Axon: Schicht=&quot;&lt;&lt;i&lt;&lt;&quot;; Neuron=&quot;&lt;&lt;j&lt;&lt;&quot; ;Pos=&quot;&lt;&lt;k&lt;&lt;&quot; ;Wert=&quot;&lt;&lt;axon_cur_neur&lt;&lt;std::endl&lt;&lt;
					&quot;WERT: &quot;&lt;&lt;nextLayerNeurVal[k]&lt;&lt;std::endl&lt;&lt;std::endl;
				}

			}
// 			if(i+1 &lt;= n_of_layers-1)
				n_annet[i+1]-&gt;getNeuAt(k)-&gt;setNeuVal(sigmoid_biasFkt(nextLayerNeurVal[k]) );
		}
	}
	delete [] nextLayerNeurVal;
	// Ausgabe
	if(ausgabe) {
		for(int k = 0; k &lt; n_annet[n_of_layers-1]-&gt;size_of_layer(); k++)
			std::cout&lt;&lt;&quot;Ausgabeneuron &quot;&lt;&lt;k&lt;&lt;&quot; = &quot;&lt;&lt;n_annet[n_of_layers-1]-&gt;getNeuAt(k)-&gt;getNeuVal()&lt;&lt;std::endl;
	}
}
</code></pre>
<p>das sind dann ein paar funkionen in der klasse neuron:</p>
<pre><code class="language-cpp">long double neuron::getNeuVal() {
	return val;
}

void neuron::setAxVal(long double v, unsigned short pos) {
	axone[pos]-&gt;setValue(v);
}

long double neuron::getAxVal(unsigned short pos) {
	return axone[pos]-&gt;getValue();
}

axon *neuron::getAxon(unsigned short pos) {
	return axone[pos];
}
</code></pre>
<p>WICHTIG: die ausgabe ändert sich nicht immer!!! lediglich das neuronen welche den wert NAN annehmnen, haben nach einen neuen durchlauf die richtigen werte... auch die speichern und laden funktion aus ner datei funktioniert....</p>
<p>ich spiele auch mit dem gedanken, das irgendwo eine zahl auf glatt 0 gerundet wird, aber ich dividiere ja nirgends...</p>
<p>wollt ihr evtl. noch die trainingsfunktion?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505283</guid><dc:creator><![CDATA[dgrat]]></dc:creator><pubDate>Thu, 08 May 2008 07:30:20 GMT</pubDate></item><item><title><![CDATA[Reply to double = NAN, obwohl ich nirgends durch NULL teilen kann?! on Thu, 08 May 2008 07:34:15 GMT]]></title><description><![CDATA[<p>das wichtsigste vergessen:<br />
wo der speicher schließlich allokiert wurde:</p>
<pre><code class="language-cpp">layer::layer(unsigned short nmb, unsigned short nmb_of_neurons, unsigned short nmb_of_axons) {
	layerNmb = nmb;

	std::cout&lt;&lt;&quot;create layer with &quot;&lt;&lt;nmb_of_neurons&lt;&lt;&quot; neurons&quot;&lt;&lt;std::endl;
	l_dim = nmb_of_neurons;
	l_axon = nmb_of_axons;

	/*! erzeuge neuronen und fülle diese mit zufallszahlen*/
	l_layer = new neuron* [l_dim];
	for(int i = 0; i &lt; l_dim; i++) {
		l_layer[i] = new neuron(this, nmb_of_axons);
	}
}
</code></pre>
<p>in der layer-klasse...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1505287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1505287</guid><dc:creator><![CDATA[dgrat]]></dc:creator><pubDate>Thu, 08 May 2008 07:34:15 GMT</pubDate></item></channel></rss>