<?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"
	>
<channel>
	<title>Comments on: Interesting behaviour in Ruby&#8217;s division and modulo operators</title>
	<atom:link href="http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/</link>
	<description>Thoughts from the nice people at Codevader :)</description>
	<pubDate>Thu, 11 Mar 2010 22:25:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Mauricio Linhares</title>
		<link>http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-106</link>
		<dc:creator>Mauricio Linhares</dc:creator>
		<pubDate>Tue, 06 May 2008 14:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-106</guid>
		<description>Well, it seems that everyone is correct (even my good old math teacher) -&#62; http://en.wikipedia.org/wiki/Remainder#The_inequality_satisfied_by_the_remainder

:)</description>
		<content:encoded><![CDATA[<p>Well, it seems that everyone is correct (even my good old math teacher) -&gt; <a href="http://en.wikipedia.org/wiki/Remainder#The_inequality_satisfied_by_the_remainder" rel="nofollow">http://en.wikipedia.org/wiki/Remainder#The_inequality_satisfied_by_the_remainder</a></p>
<p> <img src='http://blog.codevader.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mauricio Linhares</title>
		<link>http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-104</link>
		<dc:creator>Mauricio Linhares</dc:creator>
		<pubDate>Tue, 06 May 2008 14:43:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-104</guid>
		<description>Well, there doesn't seem to be a clear truth about this, nor Java neither Ruby is wrong (and not even my math teacher :D ) -&#62; http://en.wikipedia.org/wiki/Modulo_operation</description>
		<content:encoded><![CDATA[<p>Well, there doesn&#8217;t seem to be a clear truth about this, nor Java neither Ruby is wrong (and not even my math teacher <img src='http://blog.codevader.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ) -&gt; <a href="http://en.wikipedia.org/wiki/Modulo_operation" rel="nofollow">http://en.wikipedia.org/wiki/Modulo_operation</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bandi</title>
		<link>http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-103</link>
		<dc:creator>bandi</dc:creator>
		<pubDate>Tue, 06 May 2008 14:00:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-103</guid>
		<description>YoNoSoyTu is correct, integer division is not done via approximation. Consider the number 5. Integer division yields 5 = 1x3 + 2. You can see that the result is clearly 1, not 2. So you can see, that the 'floor' function is the appropriate way to describe what's going on. -7/3=2.333333... and if you take it's floor, you get -3 indeed.</description>
		<content:encoded><![CDATA[<p>YoNoSoyTu is correct, integer division is not done via approximation. Consider the number 5. Integer division yields 5 = 1&#215;3 + 2. You can see that the result is clearly 1, not 2. So you can see, that the &#8216;floor&#8217; function is the appropriate way to describe what&#8217;s going on. -7/3=2.333333&#8230; and if you take it&#8217;s floor, you get -3 indeed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: YoNoSoyTu</title>
		<link>http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-102</link>
		<dc:creator>YoNoSoyTu</dc:creator>
		<pubDate>Tue, 06 May 2008 08:33:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.codevader.com/2008/05/06/interesting-behaviour-in-rubys-division-and-modulo-operators/#comment-102</guid>
		<description>That's because the division definition states that the remainder of a division should between 0 (inclusive) and &#124;divisor&#124; (absolute value), so, being your divisor 3, the remainder should be 0, 1, 2. So the solution of Ruby (or any other programming language with integer division) is correct.

I think you should search your math teacher and gift he/she some basic algebra books.</description>
		<content:encoded><![CDATA[<p>That&#8217;s because the division definition states that the remainder of a division should between 0 (inclusive) and |divisor| (absolute value), so, being your divisor 3, the remainder should be 0, 1, 2. So the solution of Ruby (or any other programming language with integer division) is correct.</p>
<p>I think you should search your math teacher and gift he/she some basic algebra books.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
