<?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[Neuer Zahlentyp]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich möchte einen Datentyp haben, bei dem genau festgelegt ist, wie viele Stellen vor, bzw. hinter dem Komma stehen. Wie mache ich das am besten?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/123738/neuer-zahlentyp</link><generator>RSS for Node</generator><lastBuildDate>Sun, 23 Aug 2026 16:42:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/123738.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 19 Oct 2005 15:23:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 15:23:17 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich möchte einen Datentyp haben, bei dem genau festgelegt ist, wie viele Stellen vor, bzw. hinter dem Komma stehen. Wie mache ich das am besten?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896272</guid><dc:creator><![CDATA[user0]]></dc:creator><pubDate>Wed, 19 Oct 2005 15:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 15:29:09 GMT]]></title><description><![CDATA[<p>user0 schrieb:</p>
<blockquote>
<p>Hallo!</p>
<p>Ich möchte einen Datentyp haben, bei dem genau festgelegt ist, wie viele Stellen vor, bzw. hinter dem Komma stehen. Wie mache ich das am besten?</p>
</blockquote>
<p>Hallo,<br />
Wie meinst du das denn? Bei float/double/etc. ist die Genauigkeit doch festgeschrieben <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /><br />
Reicht dir selbige nicht? Dann nimm <a href="http://www.swox.com/gmp/" rel="nofollow">gmp</a> oder schreib dir eine eigene Klasse mit einer größeren Genauigkeit als sie die pods bieten. :).</p>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896274</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Wed, 19 Oct 2005 15:29:09 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 15:47:48 GMT]]></title><description><![CDATA[<p>Ich dachte bei float verschiebt sich das Komma nach hinten, wenn die Zahl größer wird (&quot;Gleitkomma&quot;).<br />
In Delphi kann man schreiben</p>
<pre><code>type neueZahl = 1..4;
</code></pre>
<p>Geht soetwas ähnliches auch in C++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896303</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896303</guid><dc:creator><![CDATA[user0]]></dc:creator><pubDate>Wed, 19 Oct 2005 15:47:48 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:01:17 GMT]]></title><description><![CDATA[<p>user0 schrieb:</p>
<blockquote>
<p>Ich dachte bei float verschiebt sich das Komma nach hinten, wenn die Zahl größer wird (&quot;Gleitkomma&quot;).<br />
In Delphi kann man schreiben</p>
<pre><code>type neueZahl = 1..4;
</code></pre>
<p>Geht soetwas ähnliches auch in C++?</p>
</blockquote>
<p>Nein. Das macht imo auch net so viel Sinn.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896320</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896320</guid><dc:creator><![CDATA[FireFlow]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:04:17 GMT]]></title><description><![CDATA[<p>Stimmt. <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>Ich will nur wissen, wie mann beispielsweise einen Datentyp definiert, der genau 4 Stellen vor und genau drei Stellen hinter dem Komma besitzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896323</guid><dc:creator><![CDATA[user0]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:04:17 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:18:29 GMT]]></title><description><![CDATA[<p>Du könntest höchstens sagen, du teilst einen 32-Bit Integer in n Vorkommabits und 32-n Nachkommabits ein.</p>
<p>Wenn du Festkomma haben willst musst du aber erstens bedenken, dass du (auf einfache Weise) nur die binären Nach- und Vorkommastellen festlegen kannst (IIRC 2<sup>n</sup>-1 und 2<sup>n-32</sup>-1) und zweitens die Länge der Integer in C++ nicht vorgegeben ist (wo man sich allerdings behelfen kann).</p>
<p>Ein Vorzeichenbit könntest du auch einplanen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896335</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:18:29 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:21:26 GMT]]></title><description><![CDATA[<p>Ok, danke. Ich werd's mal so probieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896337</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896337</guid><dc:creator><![CDATA[user0]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:21:26 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:23:46 GMT]]></title><description><![CDATA[<p>Aber bitte sauber in Klassen gekapselt und mit Operatoren versehen (am besten Boost.Operators) <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/896339</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896339</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:23:46 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 16:27:59 GMT]]></title><description><![CDATA[<p>Wie wäre es mit Procent oder Promille? 100% = 1.00</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896344</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896344</guid><dc:creator><![CDATA[Ben04]]></dc:creator><pubDate>Wed, 19 Oct 2005 16:27:59 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 20:08:09 GMT]]></title><description><![CDATA[<p>user0 schrieb:</p>
<blockquote>
<p>Ich dachte bei float verschiebt sich das Komma nach hinten, wenn die Zahl größer wird (&quot;Gleitkomma&quot;).[/code]<br />
Geht soetwas ähnliches auch in C++?</p>
</blockquote>
<p>gleitkomma bedeutet tatsächlich, daß sich die position des kommas verschiebt. die &quot;kommaposition&quot; wird bei fließkommazahlen im exponenten gespeichert. die anzahl der gültigen (binär-)stellen ist jedoch vorgegeben.</p>
<p>user0 schrieb:</p>
<blockquote>
<p>In Delphi kann man schreiben</p>
<pre><code>type neueZahl = 1..4;
</code></pre>
</blockquote>
<p>unterbereichstypen kann man in c/c++ leider nicht deklarieren. überhaupt ist das typenkonzept in c/c++ ganz anders und viel maschinennäher als in delphi.</p>
<p>zur eigentlichen frage: man kann in c++ schon eine festkommazahl-klasse definieren. es ginge sogar so, daß man ihn genauso verwenden könnte wie int/float etc.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896544</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896544</guid><dc:creator><![CDATA[Konfusius]]></dc:creator><pubDate>Wed, 19 Oct 2005 20:08:09 GMT</pubDate></item><item><title><![CDATA[Reply to Neuer Zahlentyp on Wed, 19 Oct 2005 20:10:30 GMT]]></title><description><![CDATA[<p>Nimmst int und sagst: die letzten 3 Ziffern sind immer nach dem Komma.</p>
<p>Bye, TGGC (<a href="http://tggc.tg.funpic.de/index.php?cat=4" rel="nofollow">Demo or Die</a>)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/896546</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/896546</guid><dc:creator><![CDATA[TGGC]]></dc:creator><pubDate>Wed, 19 Oct 2005 20:10:30 GMT</pubDate></item></channel></rss>