<?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[mit try floating overflow abfangen (anfängerfrage...)]]></title><description><![CDATA[<p>Hi! ich habe von meinem neuen arbeitgeber ne übungsaufgabe bekommen, ich sollte nen taschenrechner programmiern...<br />
der taschenrechner bekommt nen String mit na formel und löst diese auf. Dabei auf ungültige sachen wie division durch Null zu prüfen iss leicht, allerdings habe ich ein anderes problem:<br />
Wenn ich zu große Zahlen bekomme dann gibts ein floating overflow...<br />
wie kann ich das nun abprüfen, und dann halt nen error zurückgeben wenn die zahlen zu groß werden?</p>
<p>Ich wollte das ungefähr so haben:</p>
<pre><code>try
		{
		summe*=zsum;
		}
	catch(EMathError &amp;m)
		{
		fIsok=0;
		};
	}
</code></pre>
<p>( so vom prinzip, funzen tut das ja leider nich so... )<br />
thx im vorraus <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>wer den rechner mal austesten will: <a href="http://www.reindell.de/beatnukem/files/Rechner.exe" rel="nofollow">Rechner.exe</a><br />
( funzt nur an PC wo Borland Turbo C++ installiert iss glaub ich (hab die umsonst version benutzt)</p>
<p>edit: warum wird v o r r a u s zensiert?? lol</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/171618/mit-try-floating-overflow-abfangen-anfängerfrage</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 12:17:13 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/171618.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 27 Jan 2007 15:37:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 15:37:05 GMT]]></title><description><![CDATA[<p>Hi! ich habe von meinem neuen arbeitgeber ne übungsaufgabe bekommen, ich sollte nen taschenrechner programmiern...<br />
der taschenrechner bekommt nen String mit na formel und löst diese auf. Dabei auf ungültige sachen wie division durch Null zu prüfen iss leicht, allerdings habe ich ein anderes problem:<br />
Wenn ich zu große Zahlen bekomme dann gibts ein floating overflow...<br />
wie kann ich das nun abprüfen, und dann halt nen error zurückgeben wenn die zahlen zu groß werden?</p>
<p>Ich wollte das ungefähr so haben:</p>
<pre><code>try
		{
		summe*=zsum;
		}
	catch(EMathError &amp;m)
		{
		fIsok=0;
		};
	}
</code></pre>
<p>( so vom prinzip, funzen tut das ja leider nich so... )<br />
thx im vorraus <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>wer den rechner mal austesten will: <a href="http://www.reindell.de/beatnukem/files/Rechner.exe" rel="nofollow">Rechner.exe</a><br />
( funzt nur an PC wo Borland Turbo C++ installiert iss glaub ich (hab die umsonst version benutzt)</p>
<p>edit: warum wird v o r r a u s zensiert?? lol</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218099</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218099</guid><dc:creator><![CDATA[beatnukem]]></dc:creator><pubDate>Sat, 27 Jan 2007 15:37:05 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 15:44:12 GMT]]></title><description><![CDATA[<p>beatnukem schrieb:</p>
<blockquote>
<p>edit: warum wird v o r r a u s zensiert?? lol</p>
</blockquote>
<p>Genau, lol, @you.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218106</guid><dc:creator><![CDATA[ceplusplus]]></dc:creator><pubDate>Sat, 27 Jan 2007 15:44:12 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 15:47:31 GMT]]></title><description><![CDATA[<p>jo, weil man V o r r a u s so schreibt: Voraus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218108</guid><dc:creator><![CDATA[mikey]]></dc:creator><pubDate>Sat, 27 Jan 2007 15:47:31 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 16:02:31 GMT]]></title><description><![CDATA[<p>die eigentliche frage steht weiter oben leut <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/1218124</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218124</guid><dc:creator><![CDATA[beatnukem]]></dc:creator><pubDate>Sat, 27 Jan 2007 16:02:31 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 16:19:21 GMT]]></title><description><![CDATA[<p>Na und? Du lachst laut aus (Wohl das Forum und/oder uns), und dafür gibts keine Leckerlies!</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218140</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218140</guid><dc:creator><![CDATA[ceplusplus]]></dc:creator><pubDate>Sat, 27 Jan 2007 16:19:21 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 16:22:59 GMT]]></title><description><![CDATA[<p>ceplusplus schrieb:</p>
<blockquote>
<p>Na und? Du lachst laut aus (Wohl das Forum und/oder uns), und dafür gibts keine Leckerlies!</p>
<p>MfG</p>
</blockquote>
<p>also das forum oder euch wollt ich sicher nich auslachen...tut mir leid wenn du das so aufgefasst hast...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218143</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218143</guid><dc:creator><![CDATA[beatnukem]]></dc:creator><pubDate>Sat, 27 Jan 2007 16:22:59 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 16:30:01 GMT]]></title><description><![CDATA[<p>Wen denn sonst? ^^</p>
<p>Naja egal, sry mit exceptions hab ich mich noch nicht beschäftigt.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218150</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218150</guid><dc:creator><![CDATA[ceplusplus]]></dc:creator><pubDate>Sat, 27 Jan 2007 16:30:01 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sat, 27 Jan 2007 17:03:58 GMT]]></title><description><![CDATA[<p>so spontan ist mir da auch noch nichts über den weg gelaufen. Ich glaube was wirklich einfaches wie ein try catch gibts da nicht. Zumal es ja im Assembler ein Overflow flag gibt der genau das anzeigt. Naja ggf könnte man versuchen einfach in den nächstgrößeren zahlenbereich zu schreiben und das Ergebnis vergleichen..</p>
<p>also größere Variable anlegen dort berechnen ... in den kleineren bereich kopieren. Ergebnis vergleichen... es gibt glaube ich auch ein header wo der maximale Wert für alle veriablentypen deines Systems gespeichert ist. Aber k.A. wo man sowas findet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218174</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218174</guid><dc:creator><![CDATA[Fedaykin]]></dc:creator><pubDate>Sat, 27 Jan 2007 17:03:58 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sun, 28 Jan 2007 16:12:14 GMT]]></title><description><![CDATA[<p>hmm ok danke für die antwort...du meinst z.b. in nem long double berechnen und gucken obs über nen bestimmten wert geht? wenn ich das ergebnis vom größeren speicherbereich in den kleinen kopiere, dann gibts doch auch nen overflow oder irr ich mich da? greetz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218691</guid><dc:creator><![CDATA[bnukem]]></dc:creator><pubDate>Sun, 28 Jan 2007 16:12:14 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sun, 28 Jan 2007 16:33:29 GMT]]></title><description><![CDATA[<p>Du prüfst im größeren Typ, also double max_float = std::numeric_limits&lt; float &gt;::max(); und dann if( val &gt; max_float )...</p>
<p>Alternativ kannst du auch unportabel werden und zumindest unter Windows das SEH (Structured Exception Handling) verwenden und (auch) Hardware-Exceptions abfangen.<br />
Die Syntax ist in Visual C++ geringfügig anders, statt try schreibst du __try und fängst die Excetion in einem __except-Block.</p>
<p>Ein kleines Beispiel:</p>
<pre><code class="language-cpp">__try
{
  //hier die Berechnung
}
__except( GetExceptionCode() == EXCEPTION_FLT_OVERFLOW )
{
  //war wohl zu groß
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1218707</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218707</guid><dc:creator><![CDATA[lolz]]></dc:creator><pubDate>Sun, 28 Jan 2007 16:33:29 GMT</pubDate></item><item><title><![CDATA[Reply to mit try floating overflow abfangen (anfängerfrage...) on Sun, 28 Jan 2007 18:59:40 GMT]]></title><description><![CDATA[<p>Q lolz<br />
thx a lot das funzt wunderbar <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="😃"
    /><br />
genau sowas wollt ich haben</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1218799</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1218799</guid><dc:creator><![CDATA[bnukem]]></dc:creator><pubDate>Sun, 28 Jan 2007 18:59:40 GMT</pubDate></item></channel></rss>