Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Sorting numeric strings Date: Thu, 3 May 2012 18:11:44 -0700 (PDT) Organization: http://groups.google.com Lines: 28 Message-ID: <29053378.63.1336093904131.JavaMail.geo-discussion-forums@pbctc10> References: <2012043021273098748-no@waycom> <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com> <3s93q719q1787gb4ihi4fugvn8cvgc8nu2@4ax.com> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1336093905 12507 127.0.0.1 (4 May 2012 01:11:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 4 May 2012 01:11:45 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 Xref: csiph.com comp.lang.java.programmer:14239 Roedy Green wrote: > Dr J R Stockton wrote, quoted or indirectly quoted someone who said : >=20 >> One then only has a factor of about seven to spare if handling the US >> annual GDP. It's worse for the Chinese, whose yuan is cheaper than the >> USD by a larger factor than their GDP is less, and contains 100 fen. >=20 > They won't fail catastrophically, the way longs fail. They will just > start getting the low order digits inaccurately, which really does not > matter except for aesthetics. You have an unusual understanding of accounting. The low-order bits might matter, depending on the purpose. If you're calcul= ating, you can get unusual results due to round-off error. If your purpose = is approximate, the answers might be close enough, as you suggest. But so m= uch of accounting requires perfect accuracy, irrespective of scale, so a ca= tastrophic failure might be preferable to a graceful wrong answer. Also, a 64-bit double only has 53 bits of precision; a long has 63. So argu= ably a long is better to represent individual amounts unless you're doing f= unky calculations such as for interest. You could, for example, express the= Chinese GDP in fen. But then there's BigDecimal, with perfect accuracy. So there are choices. --=20 Lew