<?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[Summe von 1&#x2F;4 bis 1&#x2F;1048576]]></title><description><![CDATA[<p>Hallo !</p>
<p>Kann leider nich weiter. Habe schon über 3 Stunden versucht und und auf Google gibts auch nichts.</p>
<p>Die aufgabe lauten:</p>
<p>Summe der Brüche 1/2 + 1/4 + 1/8 + 1/16 + .... + 1/1048576<br />
Hier muss mit float gearbeitet werden!<br />
- Summe der ersten 10000 Glieder der Gleichung<br />
4 * (1/1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ...)</p>
<p>Hinweis für die letzte Aufgabe:<br />
Aufteilen der Werte in 2 Summen:<br />
4 * (1/1 + 1/5 + 1/9 + ...)<br />
4 * ( - 1/3 - 1/7 - 1/11 - ...)</p>
<p>Das sind meine bemühungen bis jetzt:</p>
<pre><code>#include &lt;stdio.h&gt;

int main()
{
    int x ;
    float summe ;

     for( x=1 ; x&lt;=100 ; x = x*2 )
        {
            printf(&quot;%d &quot;   , x);
        }

	printf(&quot;\n&quot;);
	printf(&quot;\n&quot;);
    printf(&quot;--------------------------------------------------------\n&quot;);
    printf(&quot;\n&quot;);

     for( summe=1/2 ; summe&lt;=1/1048576 ; summe = summe + 1/2 )
        {
            printf(&quot;%f % &quot;   , y);
        }

    printf(&quot;\n&quot;);
	printf(&quot;\n&quot;);
    printf(&quot;--------------------------------------------------------\n&quot;);
    printf(&quot;\n&quot;);

	getchar();
    return 0;
}
</code></pre>
<p>Das zwite hab ich keine ahnung wie ich es anfangen soll.</p>
<p>Danke für eure Hilfe</p>
<p>Ps.: Super Forum werde es Empfehlen <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/topic/256217/summe-von-1-4-bis-1-1048576</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 16:51:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/256217.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 09 Dec 2009 17:12:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 17:12:00 GMT]]></title><description><![CDATA[<p>Hallo !</p>
<p>Kann leider nich weiter. Habe schon über 3 Stunden versucht und und auf Google gibts auch nichts.</p>
<p>Die aufgabe lauten:</p>
<p>Summe der Brüche 1/2 + 1/4 + 1/8 + 1/16 + .... + 1/1048576<br />
Hier muss mit float gearbeitet werden!<br />
- Summe der ersten 10000 Glieder der Gleichung<br />
4 * (1/1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + ...)</p>
<p>Hinweis für die letzte Aufgabe:<br />
Aufteilen der Werte in 2 Summen:<br />
4 * (1/1 + 1/5 + 1/9 + ...)<br />
4 * ( - 1/3 - 1/7 - 1/11 - ...)</p>
<p>Das sind meine bemühungen bis jetzt:</p>
<pre><code>#include &lt;stdio.h&gt;

int main()
{
    int x ;
    float summe ;

     for( x=1 ; x&lt;=100 ; x = x*2 )
        {
            printf(&quot;%d &quot;   , x);
        }

	printf(&quot;\n&quot;);
	printf(&quot;\n&quot;);
    printf(&quot;--------------------------------------------------------\n&quot;);
    printf(&quot;\n&quot;);

     for( summe=1/2 ; summe&lt;=1/1048576 ; summe = summe + 1/2 )
        {
            printf(&quot;%f % &quot;   , y);
        }

    printf(&quot;\n&quot;);
	printf(&quot;\n&quot;);
    printf(&quot;--------------------------------------------------------\n&quot;);
    printf(&quot;\n&quot;);

	getchar();
    return 0;
}
</code></pre>
<p>Das zwite hab ich keine ahnung wie ich es anfangen soll.</p>
<p>Danke für eure Hilfe</p>
<p>Ps.: Super Forum werde es Empfehlen <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/1820222</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820222</guid><dc:creator><![CDATA[muniok]]></dc:creator><pubDate>Wed, 09 Dec 2009 17:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 17:20:22 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">for( summe=1/2 ; summe&lt;=1/1048576 ; summe = summe + 1/2 )
</code></pre>
<ol>
<li>
<p>1/2 ist größer als 1/4 ist größer als ... ist größer als 1/1048576.</p>
</li>
<li>
<p>Um von 1/2 auf 1/4 auf 1/8 zu kommen, kannst du nicht 1/2 addieren. Du musst eine andere Operation wählen.</p>
</li>
<li>
<p>Du brauchst zwei Variablen. Eine für die einzelnen Brüche 1/2, 1/4 etc. und eine für die Summe.</p>
</li>
<li>
<p>Bei solchen Brüchen immer den Typ der Zahl mit angeben. Denn 1/2 == 0, da es sich um ints handelt. int durch int ergibt wieder int, d. h. die Nachkommastellen von 1/2 = 0.5 werden einfach abgeschnitten und man erhält 0. Richtig wäre 1.0f/2.0f.</p>
</li>
</ol>
]]></description><link>https://www.c-plusplus.net/forum/post/1820227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820227</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Wed, 09 Dec 2009 17:20:22 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 17:22:15 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">for( summe=1/2 ; summe&lt;=1/1048576 ; summe = summe + 1/2 )
</code></pre>
<p>Na, was ist denn 0.5 + 0.5? Bestimmt nicht 0.25. Du meinst bestimmt was anderes als +.</p>
<p>Außerdem musst du die Werte natürlich nicht nur ausgeben, sondern auch zusammenzählen.</p>
<p>Für die zweite Reihe gehst du prinzipiell genauso ran. Da ist es etwas schwieriger das Muster zu erkennen. Tipp: Zähl einfach eine Variable in Zweierschritten und teil dann entsprechend.</p>
<p>Und etwas, dass du falsch gemacht hast: Du verwendest an vielen Stellen Integerdivision (division ohne Rest), meinst aber sicherlich Fließkommadivision. 1/2 ist in C++ gleich 0. Mindestens eine der beiden Zahlen muss von einem Fließkommatyp sein, zum Beispiel indem du 1./2 schreibst. Das ist dann tatsächlich 0.5. Wenn in der Rechnung nur Integervariablen auftauchen, so musst du diese erst in entsprechende Fließkommatypen umwandeln.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820230</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 09 Dec 2009 17:22:15 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 17:41:20 GMT]]></title><description><![CDATA[<p>es schadet auch nicht, schon mal gehört zu haben, dass man bei gleitkommazahlen(wie float bzw. double sind) zu erst die kleinen werte addieren sollte und am ende die großen...<br />
wieso das so ist, kannst du auf wikipedia oder der fachliteratur deiner wahl nachlesen (paar anhaltspunkte: genauigkeit, abschneiden von stellen)</p>
<p>bb</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820241</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820241</guid><dc:creator><![CDATA[unskilled]]></dc:creator><pubDate>Wed, 09 Dec 2009 17:41:20 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 17:51:07 GMT]]></title><description><![CDATA[<p>Danke auch habe es hingekriegt</p>
<p>Nochmals Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820248</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820248</guid><dc:creator><![CDATA[muniok]]></dc:creator><pubDate>Wed, 09 Dec 2009 17:51:07 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 20:17:49 GMT]]></title><description><![CDATA[<p>unskilled schrieb:</p>
<blockquote>
<p>es schadet auch nicht, schon mal gehört zu haben, dass man bei gleitkommazahlen(wie float bzw. double sind) zu erst die kleinen werte addieren sollte und am ende die großen...<br />
wieso das so ist, kannst du auf wikipedia oder der fachliteratur deiner wahl nachlesen (paar anhaltspunkte: genauigkeit, abschneiden von stellen)</p>
<p>bb</p>
</blockquote>
<p>Hmm. Hier würde ich wahrscheinlich gar keine floats nehmen, sondern das mit 2 Integern lösen. Respektive mit einem, wenn sich der Zähler nicht verändert.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820316</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 09 Dec 2009 20:17:49 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 21:04:34 GMT]]></title><description><![CDATA[<p>achja</p>
<p>einfach mal so als tip</p>
<p>die summe von 2<sup>-x</sup> x=i -&gt; ∞<br />
ergibt 2*2<sup>-i</sup></p>
<p>warum?</p>
<p>1/4 + 1/8 + 1/16 ...<br />
+ 1/4 + 1/8 + 1/16 ...<br />
= 1/2 + 1/4 + 1/8 + 1/16 ...<br />
- (1/4 + 1/8 + 1/16 ...)<br />
= 1/2</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820334</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Wed, 09 Dec 2009 21:04:34 GMT</pubDate></item><item><title><![CDATA[Reply to Summe von 1&#x2F;4 bis 1&#x2F;1048576 on Wed, 09 Dec 2009 21:17:32 GMT]]></title><description><![CDATA[<p>Er betrachtet aber eine endliche geometrische Reihe. Genauso könnte man sagen, dass er bei der zweiten Aufgabe Pi ausgeben soll, aber das ist nicht im Sinne der Aufgabe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1820340</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1820340</guid><dc:creator><![CDATA[Michael E.]]></dc:creator><pubDate>Wed, 09 Dec 2009 21:17:32 GMT</pubDate></item></channel></rss>