<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Once and for all: Do not use double for money</title>
	<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/</link>
	<description>Productivity in software development</description>
	<pubDate>Fri, 25 Jul 2008 03:23:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.2</generator>
		<item>
		<title>By: FEZ</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48945</link>
		<dc:creator>FEZ</dc:creator>
		<pubDate>Mon, 14 Jan 2008 16:18:34 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48945</guid>
		<description>http://en.wikipedia.org/wiki/Rounding#Round-to-even_method:

"The origin of the term bankers' rounding is more obscure. If this rounding method was ever a standard in banking, the evidence has proved extremely difficult to find. To the contrary, section 2 of the European Commission report The Introduction of the Euro and the Rounding of Currency Amounts [2] suggests that there had previously been no standard approach to rounding in banking."</description>
		<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Rounding#Round-to-even_method:" rel="nofollow">http://en.wikipedia.org/wiki/Rounding#Round-to-even_method:</a></p>
<p>&#8220;The origin of the term bankers&#8217; rounding is more obscure. If this rounding method was ever a standard in banking, the evidence has proved extremely difficult to find. To the contrary, section 2 of the European Commission report The Introduction of the Euro and the Rounding of Currency Amounts [2] suggests that there had previously been no standard approach to rounding in banking.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigDecimal money cookbook at Stephans Blog</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48919</link>
		<dc:creator>BigDecimal money cookbook at Stephans Blog</dc:creator>
		<pubDate>Mon, 14 Jan 2008 12:55:59 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48919</guid>
		<description>[...] No signal, no noise.           &#171; Once and for all: Do not use double for money [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] No signal, no noise.           &laquo; Once and for all: Do not use double for money [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48897</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 14 Jan 2008 10:00:53 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48897</guid>
		<description>ROUND_HALF_EVEN is called fair rounding because it distributes the error. It's also called bankers rounding.

http://en.wikipedia.org/wiki/Rounding#Round-to-even_method

"Rounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUND_HALF_DOWN if it's even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations."

http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN</description>
		<content:encoded><![CDATA[<p>ROUND_HALF_EVEN is called fair rounding because it distributes the error. It&#8217;s also called bankers rounding.</p>
<p><a href="http://en.wikipedia.org/wiki/Rounding#Round-to-even_method" rel="nofollow">http://en.wikipedia.org/wiki/Rounding#Round-to-even_method</a></p>
<p>&#8220;Rounding mode to round towards the &#8220;nearest neighbor&#8221; unless both neighbors are equidistant, in which case, round towards the even neighbor. Behaves as for ROUND_HALF_UP if the digit to the left of the discarded fraction is odd; behaves as for ROUND_HALF_DOWN if it&#8217;s even. Note that this is the rounding mode that minimizes cumulative error when applied repeatedly over a sequence of calculations.&#8221;</p>
<p><a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html#ROUND_HALF_EVEN</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FEZ</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48885</link>
		<dc:creator>FEZ</dc:creator>
		<pubDate>Mon, 14 Jan 2008 09:10:10 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48885</guid>
		<description>I don't know about USA, but in Europe you would use ROUND_HALF_UP for money rounding!?</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know about USA, but in Europe you would use ROUND_HALF_UP for money rounding!?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48880</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Mon, 14 Jan 2008 08:11:39 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48880</guid>
		<description>@Greg: I have the same feeling. Developers using double or float do use the wrong type in most cases except for 3D graphics or statistics.</description>
		<content:encoded><![CDATA[<p>@Greg: I have the same feeling. Developers using double or float do use the wrong type in most cases except for 3D graphics or statistics.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Finds of the Week - December 13, 2008 &#187; Chinh Do</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48868</link>
		<dc:creator>Finds of the Week - December 13, 2008 &#187; Chinh Do</dc:creator>
		<pubDate>Mon, 14 Jan 2008 06:36:25 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48868</guid>
		<description>[...] Stephan advised to use the &#34;money&#34; data type to store currency amounts instead of doubles. For good reasons. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Stephan advised to use the &quot;money&quot; data type to store currency amounts instead of doubles. For good reasons. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Miller</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48821</link>
		<dc:creator>Greg Miller</dc:creator>
		<pubDate>Mon, 14 Jan 2008 00:19:44 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48821</guid>
		<description>Quote:
--------------------------
I always distribute as [3.33, 3.33, 3.33] and then deposit 0.01 into my own secret account.
--------------------------

Just make sure you don't mess up on some mundane detail like putting a decimal point in the wrong place.

But seriously, it's been my opinion for a while that using float or double should cause a compiler warning optionally suppressed by a compiler flag.   I believe the only place a typical programmer would run into floats being used correctly would be 3D graphics programming.</description>
		<content:encoded><![CDATA[<p>Quote:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
I always distribute as [3.33, 3.33, 3.33] and then deposit 0.01 into my own secret account.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>Just make sure you don&#8217;t mess up on some mundane detail like putting a decimal point in the wrong place.</p>
<p>But seriously, it&#8217;s been my opinion for a while that using float or double should cause a compiler warning optionally suppressed by a compiler flag.   I believe the only place a typical programmer would run into floats being used correctly would be 3D graphics programming.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48673</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Sat, 12 Jan 2008 14:33:05 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48673</guid>
		<description>The comic hero, I´m really honoured.

A lot of people tried this, most of them got caught when getting greedy :-)</description>
		<content:encoded><![CDATA[<p>The comic hero, I´m really honoured.</p>
<p>A lot of people tried this, most of them got caught when getting greedy :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Burke</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48653</link>
		<dc:creator>Eric Burke</dc:creator>
		<pubDate>Sat, 12 Jan 2008 12:43:46 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48653</guid>
		<description>I always distribute as [3.33, 3.33, 3.33] and then deposit 0.01 into my own secret account.</description>
		<content:encoded><![CDATA[<p>I always distribute as [3.33, 3.33, 3.33] and then deposit 0.01 into my own secret account.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48510</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Fri, 11 Jan 2008 15:06:18 +0000</pubDate>
		<guid>http://stephan.reposita.org/archives/2008/01/11/once-and-for-all-do-not-use-double-for-money/#comment-48510</guid>
		<description>@digital.alterego: Fowler calls it allocate I guess. You have 3 people and need to distribute (allocate) 10 EUR to them. 10/3 = 3.33 in cents, which means 1 cent is lost. Distributing 10 EUR correctly will result in 3 buckets [3.33, 3.33, 3.34].</description>
		<content:encoded><![CDATA[<p>@digital.alterego: Fowler calls it allocate I guess. You have 3 people and need to distribute (allocate) 10 EUR to them. 10/3 = 3.33 in cents, which means 1 cent is lost. Distributing 10 EUR correctly will result in 3 buckets [3.33, 3.33, 3.34].</p>
]]></content:encoded>
	</item>
</channel>
</rss>
