<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Note To Self: Division By Zero Is Not A Good Idea</title>
	<atom:link href="http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/</link>
	<description>I bake games. Indie style.</description>
	<lastBuildDate>Thu, 16 May 2013 13:23:44 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Steven Egan</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137329</link>
		<dc:creator>Steven Egan</dc:creator>
		<pubDate>Mon, 02 Nov 2009 21:44:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137329</guid>
		<description>The operators are a built in function syntax. You write the function and can make it handle anything a normal function can handle, because it IS a function. I know that through experience and all the material I&#039;ve ever come across on it agrees. Since I&#039;ve done what you say can not be done, I am sure it is possible, not necessarily the best answer, but possible.</description>
		<content:encoded><![CDATA[<p>The operators are a built in function syntax. You write the function and can make it handle anything a normal function can handle, because it IS a function. I know that through experience and all the material I&#8217;ve ever come across on it agrees. Since I&#8217;ve done what you say can not be done, I am sure it is possible, not necessarily the best answer, but possible.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137267</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Fri, 30 Oct 2009 19:57:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137267</guid>
		<description>Steven I think you are barking up the wrong tree looking at operator overloading which can not be done for basic/integral/builtin types in either C, C++ or C# (I am assuming Juuso is using one of these languages).
If windows and C or C++:
https://www.securecoding.cert.org/confluence/display/seccode/FLP03-C.+Detect+and+handle+floating+point+errors

http://msdn.microsoft.com/en-us/library/c9676k6h.aspx
If Linux 
http://linux.die.net/man/3/feenableexcept

As for  C# I have never set a trap in that language so I can not help, but if IRC that would not cause a programme crash.</description>
		<content:encoded><![CDATA[<p>Steven I think you are barking up the wrong tree looking at operator overloading which can not be done for basic/integral/builtin types in either C, C++ or C# (I am assuming Juuso is using one of these languages).<br />
If windows and C or C++:<br />
<a href="https://www.securecoding.cert.org/confluence/display/seccode/FLP03-C.+Detect+and+handle+floating+point+errors" rel="nofollow">https://www.securecoding.cert.org/confluence/display/seccode/FLP03-C.+Detect+and+handle+floating+point+errors</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/c9676k6h.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/c9676k6h.aspx</a><br />
If Linux<br />
<a href="http://linux.die.net/man/3/feenableexcept" rel="nofollow">http://linux.die.net/man/3/feenableexcept</a></p>
<p>As for  C# I have never set a trap in that language so I can not help, but if IRC that would not cause a programme crash.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Egan</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137263</link>
		<dc:creator>Steven Egan</dc:creator>
		<pubDate>Fri, 30 Oct 2009 17:41:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137263</guid>
		<description>Like I said, it depends on the language. For more on overloading operators I suggest reading the following link.

http://en.wikipedia.org/wiki/Operator_overloading

if (want_more)
{
   Google(&quot;operator overloading&quot;);
};

:P</description>
		<content:encoded><![CDATA[<p>Like I said, it depends on the language. For more on overloading operators I suggest reading the following link.</p>
<p><a href="http://en.wikipedia.org/wiki/Operator_overloading" rel="nofollow">http://en.wikipedia.org/wiki/Operator_overloading</a></p>
<p>if (want_more)<br />
{<br />
   Google(&#8220;operator overloading&#8221;);<br />
};</p>
<p>:P</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sargon</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137248</link>
		<dc:creator>Sargon</dc:creator>
		<pubDate>Fri, 30 Oct 2009 10:57:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137248</guid>
		<description>Juuso,
When you devide by Zero in windows, there is a &quot;windows exception&quot;. As far as I remember. You can catch this exception, with se_translator or something like this. If you don&#039;t catch this exception, then it will cause a windows dialog to pop up.
What you can do is handle this(and other) windows exceptions and just add an assert, so when you run on debug it will break in that point.

Bottom line, I can&#039;t think of any situation you need to devide by 0, any time there is a devision by zero, its a bug. That means you need to make one solution to all devisions in your program, and not put an &#039;if&#039; only on certain places. Its also a lot more work to put an &#039;if&#039; every place you devide.</description>
		<content:encoded><![CDATA[<p>Juuso,<br />
When you devide by Zero in windows, there is a &#8220;windows exception&#8221;. As far as I remember. You can catch this exception, with se_translator or something like this. If you don&#8217;t catch this exception, then it will cause a windows dialog to pop up.<br />
What you can do is handle this(and other) windows exceptions and just add an assert, so when you run on debug it will break in that point.</p>
<p>Bottom line, I can&#8217;t think of any situation you need to devide by 0, any time there is a devision by zero, its a bug. That means you need to make one solution to all devisions in your program, and not put an &#8216;if&#8217; only on certain places. Its also a lot more work to put an &#8216;if&#8217; every place you devide.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137247</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Fri, 30 Oct 2009 10:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137247</guid>
		<description>Hmm my comment has been eaten twice, maybe because it contains links yet there is no feed back to tell me it is waiting moderation.</description>
		<content:encoded><![CDATA[<p>Hmm my comment has been eaten twice, maybe because it contains links yet there is no feed back to tell me it is waiting moderation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juuso</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137236</link>
		<dc:creator>Juuso</dc:creator>
		<pubDate>Fri, 30 Oct 2009 06:00:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137236</guid>
		<description>@Israel: heheee :D

@Brian: yeh, something like that was in my mind. 

@Steven &amp; Liam: could you give some example...?</description>
		<content:encoded><![CDATA[<p>@Israel: heheee :D</p>
<p>@Brian: yeh, something like that was in my mind. </p>
<p>@Steven &#038; Liam: could you give some example&#8230;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Egan</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137228</link>
		<dc:creator>Steven Egan</dc:creator>
		<pubDate>Thu, 29 Oct 2009 22:26:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137228</guid>
		<description>Coding Padawan here to help. The nifty answer I know about is to &quot;overload&quot; the division operator for the specific case of dividing by zero. Then you can give a &quot;safe&quot; fail situation rather than triggering a crash. How to do that depends on languages and other such things.

Of course then there are fun little things you can do like one calculator assignment I did, where if a person divided by zero five times in a row the program told off the user and closed itself. It was just command line, but I thought it was funny.</description>
		<content:encoded><![CDATA[<p>Coding Padawan here to help. The nifty answer I know about is to &#8220;overload&#8221; the division operator for the specific case of dividing by zero. Then you can give a &#8220;safe&#8221; fail situation rather than triggering a crash. How to do that depends on languages and other such things.</p>
<p>Of course then there are fun little things you can do like one calculator assignment I did, where if a person divided by zero five times in a row the program told off the user and closed itself. It was just command line, but I thought it was funny.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian 'Psychochild' Green</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137227</link>
		<dc:creator>Brian 'Psychochild' Green</dc:creator>
		<pubDate>Thu, 29 Oct 2009 21:41:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137227</guid>
		<description>If  you&#039;re programming in C/C++, you can use this type of statement if you suspect you could be dividing by zero:

(divisor ? dividend/divisor : 0)

This checks if the divisor evaluates to true (non-zero) before trying to divide by it.  The last part. &quot;0&quot;, could be whatever makes sense.

Another thing to watch out for is variable initialization.  If you initialize a variable to 0 and don&#039;t add anything to it before you try to divide by the variable, then you&#039;ll run into problems.

Hope that helps. :)</description>
		<content:encoded><![CDATA[<p>If  you&#8217;re programming in C/C++, you can use this type of statement if you suspect you could be dividing by zero:</p>
<p>(divisor ? dividend/divisor : 0)</p>
<p>This checks if the divisor evaluates to true (non-zero) before trying to divide by it.  The last part. &#8220;0&#8243;, could be whatever makes sense.</p>
<p>Another thing to watch out for is variable initialization.  If you initialize a variable to 0 and don&#8217;t add anything to it before you try to divide by the variable, then you&#8217;ll run into problems.</p>
<p>Hope that helps. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137226</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Thu, 29 Oct 2009 21:39:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137226</guid>
		<description>If you are using an IEEE 754 implementation of floating points you can set a trap handler for the division by zero operation.</description>
		<content:encoded><![CDATA[<p>If you are using an IEEE 754 implementation of floating points you can set a trap handler for the division by zero operation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Israel Lazo</title>
		<link>http://www.gameproducer.net/2009/10/29/note-to-self-division-by-zero-is-not-a-good-idea/comment-page-1/#comment-137224</link>
		<dc:creator>Israel Lazo</dc:creator>
		<pubDate>Thu, 29 Oct 2009 20:41:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.gameproducer.net/?p=3815#comment-137224</guid>
		<description>Only Chuck Norris can divide by zero</description>
		<content:encoded><![CDATA[<p>Only Chuck Norris can divide by zero</p>
]]></content:encoded>
	</item>
</channel>
</rss>
