<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt">Heck, there's been more than 500% inflation since the penny was useful.  Do it in nickels.  Or dimes.<br><br><rant><br><br>My personal opinion (worth 2 of the things I think are useless) is that the penny should have gone the way of the lira when the dollar coin came out, and do a hardware register shift right (register as in cash register), leaving the nickel as the smallest coin in the till.<br><br>Heck, they should have done it twice, and gotten a $2 coin (or $5), and done away with the nickel.<br><br>It was interesting (to my penny-ante-mind) how they made change in Italy (30 years ago) when they still had the lira.  It was difficult to get a 50 lira bill that was structurally sound enough to hold itself together so most transactions rounded to 100-ish lira.  Mas o
 minas, to go polyglot on you.  All this US-anal-retentive-penny-retentive accounting is a waste of time, and time is money.<br><br>Riddle me this, joker... <br><br>If it takes you more than a penny's time to account for a penny, what's that called?<br><br></rant><br><br>Amit...<br><br>Hope the "don't use fractions" design pattern helped.  My rant was independent of that.  I really *do* hope that you're dealing with a business where the more important aspect is do you have enough bits to hold that many pennies!<br><br><br> Michael R. Wolf<br>____MichaelRWolf@att.net<br>________All mammals learn by playing.<div><br></div><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font face="Tahoma" size="2"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Amit Sett <amitsett@gmail.com><br><b><span
 style="font-weight: bold;">To:</span></b> Fred Morris <m3047@m3047.net><br><b><span style="font-weight: bold;">Cc:</span></b> SPUG <spug-list@pm.org><br><b><span style="font-weight: bold;">Sent:</span></b> Wed, November 23, 2011 10:10:14 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: SPUG: Rounding error<br></font><br>
Thanks Fred. I did things in pennies and it worked.<div>-Amit</div><div><br><br><div class="gmail_quote">On Wed, Nov 23, 2011 at 9:48 AM, Fred Morris <span dir="ltr"><<a rel="nofollow" ymailto="mailto:m3047@m3047.net" target="_blank" href="mailto:m3047@m3047.net">m3047@m3047.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On Wednesday 23 November 2011 10:24, Amit Sett wrote:<br>
> [...] The program works well except for some cases where it short<br>
> changes a customer by 1 penny [...]<br>
<br>
Try doing things in pennies, e.g. a dollar is 100 pennies.<br>
<br>
Do you know what a repeating decimal is, and do you know what causes them?<br>
Basically any time you divide 1 by a prime number not in your number base you<br>
get a repeating decimal.<br>
<br>
For instance in base 10 (2 * 5) if you divide by 3, 7, 11, 13, etc. you get a<br>
repeating decimal.<br>
<br>
In base 2, dividing by 3, 5, 7, 11, etc does the same thing. If you divide by<br>
100 (2 * 2 * 5 * 5) you get a repeating decimal, or in other words there is<br>
rounding error.<br>
<br>
ObMathNote: 0.9999999... actually is provably equal to 1. ;-)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<br>
Fred<br>
<br>
_____________________________________________________________<br>
Seattle Perl Users Group Mailing List<br>
     POST TO: <a rel="nofollow" ymailto="mailto:spug-list@pm.org" target="_blank" href="mailto:spug-list@pm.org">spug-list@pm.org</a><br><span>
SUBSCRIPTION: <a target="_blank" href="http://mail.pm.org/mailman/listinfo/spug-list">http://mail.pm.org/mailman/listinfo/spug-list</a></span><br>
    MEETINGS: 3rd Tuesdays<br><span>
    WEB PAGE: <a target="_blank" href="http://seattleperl.org/">http://seattleperl.org/</a></span><br>
</font></span></blockquote></div><br></div>
</div></div>



</div></body></html>