<?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[int64_t Größe]]></title><description><![CDATA[<p>Hi, folgende Fragen:<br />
Ich habe ein int64_t, wieviel speicher allokiert da meine Variable erstmal ganz allgemein?<br />
Wenn ihc jetzt eine Zahl habe, z.B. 132993784300165 , wieviel Platz würde diese Zahl theoretisch minimal benötigen (in Bytes)? Soviel ich weiß hat doch jede Zahl intern jeder Ziffer 1 Byte zugeordnet um diese darstellen zu können, oder ? Das würde heissen die Zahl benötigt minimal 15 Byte ?</p>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/300176/int64_t-größe</link><generator>RSS for Node</generator><lastBuildDate>Wed, 12 Aug 2026 22:51:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/300176.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Feb 2012 11:07:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to int64_t Größe on Mon, 27 Feb 2012 11:07:04 GMT]]></title><description><![CDATA[<p>Hi, folgende Fragen:<br />
Ich habe ein int64_t, wieviel speicher allokiert da meine Variable erstmal ganz allgemein?<br />
Wenn ihc jetzt eine Zahl habe, z.B. 132993784300165 , wieviel Platz würde diese Zahl theoretisch minimal benötigen (in Bytes)? Soviel ich weiß hat doch jede Zahl intern jeder Ziffer 1 Byte zugeordnet um diese darstellen zu können, oder ? Das würde heissen die Zahl benötigt minimal 15 Byte ?</p>
<p>Viele Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2186143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2186143</guid><dc:creator><![CDATA[Dark_Alfred]]></dc:creator><pubDate>Mon, 27 Feb 2012 11:07:04 GMT</pubDate></item><item><title><![CDATA[Reply to int64_t Größe on Mon, 27 Feb 2012 11:09:20 GMT]]></title><description><![CDATA[<p>ein int64_t ist, wie der Name schon sagt, 64 Bit breit. Im Allgemeinen kann man davon ausgehen, dass ein Byte 8 Bit hat. Ein int64_t belegt dann also 8 Byte.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2186145</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2186145</guid><dc:creator><![CDATA[dot]]></dc:creator><pubDate>Mon, 27 Feb 2012 11:09:20 GMT</pubDate></item><item><title><![CDATA[Reply to int64_t Größe on Mon, 27 Feb 2012 11:15:43 GMT]]></title><description><![CDATA[<p>Dark_Alfred schrieb:</p>
<blockquote>
<p>Wenn ihc jetzt eine Zahl habe, z.B. 132993784300165 , wieviel Platz würde diese Zahl theoretisch minimal benötigen (in Bytes)?</p>
</blockquote>
<p>Rechne sie ins Binärsystem um, dann weißt du die Anzahl der Bits. Oder mach es über den Zweierlogarithmus: <span class="katex"><span class="katex-mathml"><math><semantics><mrow><msub><mi>n</mi><mrow><mtext><mi mathvariant="normal">B</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">s</mi></mtext></mrow></msub><mo>=</mo><mo>⌈</mo><msub><mi>log</mi><mn>2</mn></msub><mo>(</mo><mi>x</mi><mo>+</mo><mn>1</mn><mo>)</mo><mo>⌉</mo></mrow><annotation encoding="application/x-tex">n_{\text{Bits}} = \lceil \log_2(x+1) \rceil</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="strut" style="height:0.75em;"></span><span class="strut bottom" style="height:1em;vertical-align:-0.25em;"></span><span class="base textstyle uncramped"><span class="mord"><span class="mord mathit">n</span><span class="vlist"><span style="top:0.15em;margin-right:0.05em;margin-left:0em;"><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="text mord scriptstyle cramped"><span class="mord mathrm">B</span><span class="mord mathrm">i</span><span class="mord mathrm">t</span><span class="mord mathrm">s</span></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="mrel">=</span><span class="mopen">⌈</span><span class="mop"><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="vlist"><span style="top:0.24444em;margin-right:0.05em;"><span class="fontsize-ensurer reset-size5 size5"><span style="font-size:0em;">​</span></span><span class="reset-textstyle scriptstyle cramped"><span class="mord mathrm">2</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="mopen">(</span><span class="mord mathit">x</span><span class="mbin">+</span><span class="mord mathrm">1</span><span class="mclose">)</span><span class="mclose">⌉</span></span></span></span> (nur für positive x)</p>
<blockquote>
<p>Soviel ich weiß hat doch jede Zahl intern jeder Ziffer 1 Byte zugeordnet um diese darstellen zu können, oder ?</p>
</blockquote>
<p>So ein System gibt es, das heißt BCD (binary coded decimal), aber das ist für normale Arithmetik nicht üblich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2186146</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2186146</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Mon, 27 Feb 2012 11:15:43 GMT</pubDate></item><item><title><![CDATA[Reply to int64_t Größe on Mon, 27 Feb 2012 18:24:56 GMT]]></title><description><![CDATA[<p>Dark_Alfred schrieb:</p>
<blockquote>
<p>Soviel ich weiß hat doch jede Zahl intern jeder Ziffer 1 Byte zugeordnet um diese darstellen zu können, oder ? Das würde heissen die Zahl benötigt minimal 15 Byte ?</p>
</blockquote>
<p>Meinst du die darstellung jeder Ziffer als ASCII-Zeichen? Nein, das ist nicht üblich. Ein Computer rechnet doch nicht im Dezimal-System (kann er technisch gesehen auch nicht), sondern im Binärsystem. Dein Beispiel ist Binär dargestellt</p>
<pre><code>01111000 11110101 00000111 01000101 01000010 10000101
</code></pre>
<p>(Big Endian)</p>
<p>Braucht also 6 Bytes. Das heißt, dein <code>int64_t</code> reicht.</p>
<p>Edit: Das geht natürlich auch einfacher. Bei etwas kleineren Zahlen kann man sich beispielsweise die nächst-größere Zweiterpotenz ansehen und daran feststellen, ob diese größer als 2 hoch...</p>
<pre><code>- 8 (1 Byte (reicht))
- 16 (2 Bytes (reichen))
- 64 (8 Bytes (reichen))
</code></pre>
<p>ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2186336</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2186336</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 27 Feb 2012 18:24:56 GMT</pubDate></item></channel></rss>