<?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[Eulersche Zahl mithilfe von Schleife]]></title><description><![CDATA[<p>Hey,</p>
<p>Ich versuch grad eine Aufgabe zu lösen. Man soll mithilfe von Schleifen die Eulersche Zahl hinbekommen, also <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn><mo>⋅</mo><mn>3</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn><mo>⋅</mo><mn>3</mn><mo>⋅</mo><mn>4</mn></mrow></mfrac></mrow><annotation encoding="application/x-tex">1 + \frac{1}{1} + \frac{1}{1\cdot2} + \frac{1}{1\cdot2\cdot3} + \frac{1}{1\cdot2\cdot3\cdot4}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.845108em;"></span><span class="strut bottom" style="height:1.190108em;vertical-align:-0.345em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span><span class="mbin">⋅</span><span class="mord mathrm">3</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span><span class="mbin">⋅</span><span class="mord mathrm">3</span><span class="mbin">⋅</span><span class="mord mathrm">4</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span></span></span></span> usw.</p>
<p>Hab das dann so versucht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

int fakultaet(int n){
    int fakultaet = 1;
    double ZwischenZahl;
    double eulerscheZahl = 0;
    int i = 1;
    int Konstante = 1;

    while(i &lt;= 15){
          fakultaet *= i;
          ZwischenZahl = Konstante / fakultaet;
          eulerscheZahl += ZwischenZahl;
          cout &lt;&lt; eulerscheZahl &lt;&lt; endl;
          i++;
          }
          return fakultaet2;
    }

int main(){

    int n;

    cout&lt;&lt; &quot;Gib eine Zahl ein: &quot;;
    cin&gt;&gt; n;

    cout&lt;&lt; fakultaet(n) &lt;&lt; endl;

}
</code></pre>
<p>Allerdings hakt es irgendwo und ich komm einfach nicht drauf, ich krieg in der Konsole die Ausgabe</p>
<p>1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
2004310016</p>
<p>Kann mir vielleicht jemand nen Tipp geben, was ich ändern müsste?</p>
<p>Freundliche Grüsse</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/309194/eulersche-zahl-mithilfe-von-schleife</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 11:18:28 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/309194.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Oct 2012 17:05:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 17:05:50 GMT]]></title><description><![CDATA[<p>Hey,</p>
<p>Ich versuch grad eine Aufgabe zu lösen. Man soll mithilfe von Schleifen die Eulersche Zahl hinbekommen, also <span class="katex"><span class="katex-mathml"><math><semantics><mrow><mn>1</mn><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn><mo>⋅</mo><mn>3</mn></mrow></mfrac><mo>+</mo><mfrac><mrow><mn>1</mn></mrow><mrow><mn>1</mn><mo>⋅</mo><mn>2</mn><mo>⋅</mo><mn>3</mn><mo>⋅</mo><mn>4</mn></mrow></mfrac></mrow><annotation encoding="application/x-tex">1 + \frac{1}{1} + \frac{1}{1\cdot2} + \frac{1}{1\cdot2\cdot3} + \frac{1}{1\cdot2\cdot3\cdot4}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.845108em;"></span><span class="strut bottom" style="height:1.190108em;vertical-align:-0.345em;"></span><span class="base textstyle uncramped"><span class="mord mathrm">1</span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span><span class="mbin">⋅</span><span class="mord mathrm">3</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span><span class="mbin">+</span><span class="mord reset-textstyle textstyle uncramped"><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span><span class="mfrac"><span class="vlist"><span style="top:0.345em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord scriptstyle cramped"><span class="mord mathrm">1</span><span class="mbin">⋅</span><span class="mord mathrm">2</span><span class="mbin">⋅</span><span class="mord mathrm">3</span><span class="mbin">⋅</span><span class="mord mathrm">4</span></span></span></span><span style="top:-0.22999999999999998em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle textstyle uncramped frac-line"></span></span><span style="top:-0.394em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle uncramped"><span class="mord scriptstyle uncramped"><span class="mord mathrm">1</span></span></span></span><span class="baseline-fix"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span>​</span></span></span><span class="sizing reset-size5 size5 reset-textstyle textstyle uncramped nulldelimiter"></span></span></span></span></span> usw.</p>
<p>Hab das dann so versucht:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

using namespace std;

int fakultaet(int n){
    int fakultaet = 1;
    double ZwischenZahl;
    double eulerscheZahl = 0;
    int i = 1;
    int Konstante = 1;

    while(i &lt;= 15){
          fakultaet *= i;
          ZwischenZahl = Konstante / fakultaet;
          eulerscheZahl += ZwischenZahl;
          cout &lt;&lt; eulerscheZahl &lt;&lt; endl;
          i++;
          }
          return fakultaet2;
    }

int main(){

    int n;

    cout&lt;&lt; &quot;Gib eine Zahl ein: &quot;;
    cin&gt;&gt; n;

    cout&lt;&lt; fakultaet(n) &lt;&lt; endl;

}
</code></pre>
<p>Allerdings hakt es irgendwo und ich komm einfach nicht drauf, ich krieg in der Konsole die Ausgabe</p>
<p>1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
1<br />
2004310016</p>
<p>Kann mir vielleicht jemand nen Tipp geben, was ich ändern müsste?</p>
<p>Freundliche Grüsse</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261077</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261077</guid><dc:creator><![CDATA[rocknrolla]]></dc:creator><pubDate>Tue, 16 Oct 2012 17:05:50 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 17:12:14 GMT]]></title><description><![CDATA[<pre><code>Konstante / fakultaet
</code></pre>
<p>ist 'ne Ganzzahl-Division. Da kommt beim ersten Mal Eins und danach nur noch Null raus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261080</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261080</guid><dc:creator><![CDATA[Caligulaminus]]></dc:creator><pubDate>Tue, 16 Oct 2012 17:12:14 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 17:12:36 GMT]]></title><description><![CDATA[<p>Mein Tipp wär: Schnapp dir deinen Debugger und stepp einfach mal durch den Code und schau, was genau passiert... <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/2261081</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261081</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Tue, 16 Oct 2012 17:12:36 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 17:26:47 GMT]]></title><description><![CDATA[<p>Muss erstmal rausfinden wie das mit dem Debugger genau funktioniert, aber bin auch so schon durch den Tip von Caligulaminus ein Stück weitergekommen, jetzt steht immernhin nichtmehr 15mal das gleiche und die Nachkommastellen stimmen auch schon</p>
<p>thx <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261084</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261084</guid><dc:creator><![CDATA[rocknrolla]]></dc:creator><pubDate>Tue, 16 Oct 2012 17:26:47 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:00:09 GMT]]></title><description><![CDATA[<p>Soso, ITET <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Die Funktion würde ich nicht fakultaet() nennen, da sie auch e berechnet und ausgibt. Und eine for-Schleife wäre hier praktisch. Ausserdem verwendest du den Parameter n gar nie.</p>
<p>PS: Ignorier Sone am besten, der hat nur eine grosse Klappe. Mods, könnt ihr solche Beiträge von Zeit zu Zeit löschen? Als Anfänger ist das obermühsam, wenn ständig so ein Klugscheisser Verwirrung stiftet (Wem soll man so glauben?). Weder numeric_limits noch pow hat irgendwas mit dem Thema zu tun, und erst recht nicht deren Kombination.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261113</guid><dc:creator><![CDATA[Der Wisser]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:00:09 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:06:20 GMT]]></title><description><![CDATA[<p>Der Wisser schrieb:</p>
<blockquote>
<p>Mods, könnt ihr solche Beiträge von Zeit zu Zeit löschen?</p>
</blockquote>
<p>Da haste Recht. Wenn ich ihn korrigiere, kann ich ihn auch gleich löschen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261115</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:06:20 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:20:55 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Der Wisser schrieb:</p>
<blockquote>
<p>Mods, könnt ihr solche Beiträge von Zeit zu Zeit löschen?</p>
</blockquote>
<p>Da haste Recht. Wenn ich ihn korrigiere, kann ich ihn auch gleich löschen.</p>
</blockquote>
<p>Ich wollte eben nur anmerken, dass es einfachere Methoden wie die <a href="http://de.wikipedia.org/wiki/Eulersche_Zahl#Zinseszinsrechnung" rel="nofollow">Zinseszinsrechnung</a> gibt, dass der TE also diese Version mit Schleife gar nicht benutzen muss um die eulersche Zahl zu berechnen.</p>
<p>(Wer weiß, vielleicht sagt sein Prof ihm das)</p>
<p>Klar, war dumm dass ich da gleich mit sowas kam, war eben für out.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261117</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261117</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:20:55 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:30:12 GMT]]></title><description><![CDATA[<p>Dumm war: Wie berechnest du reelle Potenzen ohne e zu kennen?</p>
<p>Das ist als würdest du dich über einen Pi-Algorithmus lustig machen, dass man doch viel einfacher 4*acos(1) berechnen könnte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261119</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:30:12 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:31:51 GMT]]></title><description><![CDATA[<p>Du solltest auch mal überprüfen, ob du bei 15! mit einem <code>int</code> noch hinkommst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261122</guid><dc:creator><![CDATA[DirkB]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:31:51 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 19:40:48 GMT]]></title><description><![CDATA[<p>SeppJ schrieb:</p>
<blockquote>
<p>Dumm war: Wie berechnest du reelle Potenzen ohne e zu kennen?</p>
</blockquote>
<p>Was meinste mit &quot;reele Potenz&quot;? Potenz mit reelem Exponenten?</p>
<pre><code class="language-cpp">unsigned precision = 10000; //bpsw. 10000
    long double res = 1,
                factor = 1 + 1 / static_cast&lt;long double&gt;(precision);
    while(--precision)
        res *= factor;
</code></pre>
<p>Da ist dann aber wieder die Schleife <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
<p>btw, zu PI: Na gut, so bräge ist aber echt keiner.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261126</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261126</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 16 Oct 2012 19:40:48 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 20:38:50 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>SeppJ schrieb:</p>
<blockquote>
<p>Dumm war: Wie berechnest du reelle Potenzen ohne e zu kennen?</p>
</blockquote>
<p>Was meinste mit &quot;reele Potenz&quot;? Potenz mit reelem Exponenten?</p>
</blockquote>
<p>Genau.</p>
<blockquote>
<p>Da ist dann aber wieder die Schleife <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
</blockquote>
<p>Wenigstens erkennst du es <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261141</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261141</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 16 Oct 2012 20:38:50 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 20:44:19 GMT]]></title><description><![CDATA[<p>Zum Glück gibt es in &lt;cmath&gt; eine Überladung von pow ohne reelle Potenz.<br />
Und genau diese würde in meinem Beispiel benutzt, also war an meiner Überlegung gar nichts dumm.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261142</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 16 Oct 2012 20:44:19 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Tue, 16 Oct 2012 21:13:26 GMT]]></title><description><![CDATA[<p>#include &lt;iostream&gt; //Input, output<br />
#include &lt;iomanip&gt; //Setting higher floating point precision (i.e more decimal points)</p>
<p>int main()<br />
{<br />
//Accuracy of the calculation<br />
int acc = 30;<br />
//Variable for e<br />
double eu = 0;<br />
//Last result<br />
int last_res = 1;</p>
<p>//Loop: 1/i!, simulated by multiplying the last result for less runtime cost<br />
for (int i = 1; i &lt; acc; ++i)<br />
{<br />
eu += 1.0 / last_res;<br />
last_res *= i;<br />
}</p>
<p>//Output, 15 digits precision<br />
std::cout &lt;&lt; std::setprecision(15) &lt;&lt; eu &lt;&lt; '\n';<br />
}</p>
<p>Meine Version.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261151</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261151</guid><dc:creator><![CDATA[defsc]]></dc:creator><pubDate>Tue, 16 Oct 2012 21:13:26 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Wed, 17 Oct 2012 00:14:30 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;type_traits&gt;

template &lt;unsigned N&gt;
struct unsigned_
        : std::integral_constant&lt;unsigned, N&gt;
{};

template &lt;unsigned N&gt;
struct fac
        : unsigned_&lt;fac&lt;N - 1&gt;::value * N&gt;
{};

template &lt;&gt;
struct fac&lt;0&gt;
        : unsigned_&lt;1&gt;
{};

template &lt;unsigned N&gt;
struct e
{
        static double const value = 1. / fac&lt;N&gt;::value + e&lt;N - 1&gt;::value;
};

template &lt;&gt;
struct e&lt;0&gt;
{
        static double const value = 1.;
};

int main()
{
        std::cout.precision(15);
        std::cout &lt;&lt; e&lt;20&gt;::value;
}
</code></pre>
<p><a href="http://ideone.com/nGO8Q" rel="nofollow">http://ideone.com/nGO8Q</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261175</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261175</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Wed, 17 Oct 2012 00:14:30 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Wed, 17 Oct 2012 03:30:21 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">template &lt;unsigned N&gt;
struct e
{
        static constexpr double value = 1. / fac&lt;N&gt;::value + e&lt;N - 1&gt;::value;
};

template &lt;&gt;
struct e&lt;0&gt;
{
        static constexpr double value = 1.;
};
</code></pre>
<p>Wenn es legal sein soll.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261177</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261177</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 17 Oct 2012 03:30:21 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Wed, 17 Oct 2012 03:52:12 GMT]]></title><description><![CDATA[<p>'legal'? Seit wann sind denn double-Konstanten nicht erlaubt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261179</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261179</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Wed, 17 Oct 2012 03:52:12 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Wed, 17 Oct 2012 04:56:04 GMT]]></title><description><![CDATA[<p>Kann jemand mal den Sone sperren, soviel Inkompetenz trifft man selten in einem Thread. Aber irgendeinen Trottel mit großer Klappe gibt es meist in einem Fachforum. Ich hoffe der macht nie eine Ausbildung zum Fachinformatiker, aber dafür reicht glaube ich sein Horizont nicht ganz aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261181</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261181</guid><dc:creator><![CDATA[SoneMrInkompetenz]]></dc:creator><pubDate>Wed, 17 Oct 2012 04:56:04 GMT</pubDate></item><item><title><![CDATA[Reply to Eulersche Zahl mithilfe von Schleife on Wed, 17 Oct 2012 08:42:10 GMT]]></title><description><![CDATA[<p>Kellerautomat schrieb:</p>
<blockquote>
<p>'legal'? Seit wann sind denn double-Konstanten nicht erlaubt?</p>
</blockquote>
<p>Selbstverständlich sind double-Konstanten erlaubt.</p>
<p>Die Initialisierung von nicht-volatile const static-Membern in der Klassendefinition ist aber nur zulässig, wenn es sich um einen integralen oder Aufzählungstypen handelt (wie in C++03), es sei denn, die Variable wird mit constexpr deklariert.</p>
<p>n3337 9.4.2/3 schrieb:</p>
<blockquote>
<p>If a <strong>non-volatile const static data member</strong> is <strong>of integral or enumeration type</strong>, its declaration in the class<br />
definition can specify a brace-or-equal-initializer in which every initializer-clause that is an assignment-<br />
expression is a constant expression (5.19). A <strong>static data member of literal type</strong> can be declared in the<br />
class definition <strong>with the constexpr specifier</strong>; if so, its declaration shall specify a brace-or-equal-initializer<br />
in which every initializer-clause that is an assignment-expression is a constant expression. [ Note: In both<br />
these cases, the member may appear in constant expressions. — end note ] The member shall still be defined<br />
in a namespace scope if it is odr-used (3.2) in the program and the namespace scope definition shall not<br />
contain an initializer.</p>
</blockquote>
<p>Das Text ist an dieser Stelle erst relativ spät geändert worden, was erklärt, weshalb Compiler gegenwärtig Initialisierung bei einfachem const oft erlauben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2261220</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2261220</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 17 Oct 2012 08:42:10 GMT</pubDate></item></channel></rss>