<?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[Float Literale und ill-formed-ness]]></title><description><![CDATA[<p>Hallo,</p>
<p>ein Program das zu große Literale für den jeweils größten Datentyp enthält gilt ja (nach dem was ich bis jetzt gelesen habe) als &quot;ill-formed&quot; und sollte damit UB auslösen, richtig soweit?</p>
<p>Bei integer Literalen ist das ja relativ einfach, wenn das Literal größer ist als der größt-mögliche integer Typ fassen kann, ist das Program ill-formed.</p>
<p>Wie ist das jetzt aber bei float/double Literalen, speziell mit Stellen <em>nach</em> dem Komma? Bei floats muss ja auch beim rechnen eh immer gerundet werden, sind dann Programme wie etwa</p>
<pre><code>double x = 1.00000000000000000000000000000000000000000000000000000000000000001;
</code></pre>
<p>auch ill-formed? Oder betrifft das nur die Stellen vor dem Komma?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/334351/float-literale-und-ill-formed-ness</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 17:52:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/334351.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Sep 2015 07:26:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Float Literale und ill-formed-ness on Tue, 08 Sep 2015 07:26:42 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ein Program das zu große Literale für den jeweils größten Datentyp enthält gilt ja (nach dem was ich bis jetzt gelesen habe) als &quot;ill-formed&quot; und sollte damit UB auslösen, richtig soweit?</p>
<p>Bei integer Literalen ist das ja relativ einfach, wenn das Literal größer ist als der größt-mögliche integer Typ fassen kann, ist das Program ill-formed.</p>
<p>Wie ist das jetzt aber bei float/double Literalen, speziell mit Stellen <em>nach</em> dem Komma? Bei floats muss ja auch beim rechnen eh immer gerundet werden, sind dann Programme wie etwa</p>
<pre><code>double x = 1.00000000000000000000000000000000000000000000000000000000000000001;
</code></pre>
<p>auch ill-formed? Oder betrifft das nur die Stellen vor dem Komma?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2467155</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2467155</guid><dc:creator><![CDATA[happystudent]]></dc:creator><pubDate>Tue, 08 Sep 2015 07:26:42 GMT</pubDate></item><item><title><![CDATA[Reply to Float Literale und ill-formed-ness on Tue, 08 Sep 2015 07:33:31 GMT]]></title><description><![CDATA[<blockquote>
<p>ein Program das zu große Literale für den jeweils größten Datentyp enthält gilt ja (nach dem was ich bis jetzt gelesen habe) als &quot;ill-formed&quot; und sollte damit UB auslösen, richtig soweit?</p>
</blockquote>
<p>ill-formed != UB. Sonst richtig.</p>
<blockquote>
<p>Wie ist das jetzt aber bei float/double Literalen, speziell mit Stellen <em>nach</em> dem Komma?</p>
</blockquote>
<p>Da wird einfach entsprechend approximiert.</p>
<p>[lex.fcon]/1 schrieb:</p>
<blockquote>
<p>If the scaled value is in the range of representable values for its type, the result is the scaled value if representable, else the larger or smaller representable value nearest the scaled value, chosen in an implementation-defined manner.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2467158</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2467158</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 08 Sep 2015 07:33:31 GMT</pubDate></item><item><title><![CDATA[Reply to Float Literale und ill-formed-ness on Tue, 08 Sep 2015 07:41:34 GMT]]></title><description><![CDATA[<p>Ah, ok vielen Dank <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/2467161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2467161</guid><dc:creator><![CDATA[happystudent]]></dc:creator><pubDate>Tue, 08 Sep 2015 07:41:34 GMT</pubDate></item></channel></rss>