Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: Sorting numeric strings Date: Fri, 4 May 2012 23:36:52 +0000 (UTC) Organization: UK Free Software Network Lines: 43 Message-ID: References: <2012043021273098748-no@waycom> <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com> <3s93q719q1787gb4ihi4fugvn8cvgc8nu2@4ax.com> <29053378.63.1336093904131.JavaMail.geo-discussion-forums@pbctc10> NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1336174612 27976 84.45.235.129 (4 May 2012 23:36:52 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Fri, 4 May 2012 23:36:52 +0000 (UTC) User-Agent: Pan/0.135 (Tomorrow I'll Wake Up and Scald Myself with Tea; GIT 30dc37b master) Xref: csiph.com comp.lang.java.programmer:14273 On Fri, 04 May 2012 14:19:51 -0700, Gene Wirchenko wrote: > On Fri, 4 May 2012 20:01:50 +0000 (UTC), Martin Gregorie > wrote: > > [snip] > >>I think you'll find that using floating point for financial amounts was >>an abberation introduced by programmers on early 8 and 16 bit micros who >>wrote financial packages in BASIC. > > I suspect that it raised its head on earlier systems that did not > have COBOL or another language with decimal arithmetic. > Wrong. I was developing and maintaining accounting systems that held financial amounts as binary cents/pence in assembler long before I learnt COBOL. All early mainframes up to and including the S/360 and AS/400 (aka Future Series, System/38) and ICL 1900/2900/3900 handled financial calculations this way. COBOL merely made this easier - PIC S9(7).99 COMP SYNC. matched with PIC Z,ZZZ,ZZ9.99DB BLANK WHEN ZERO. > With JavaScript, short of writing a fixed-point library, you have > to use floating point since JavaScript has only one numeric type, namely > IEEE 754 64-bit floating point. > You may use JavaScript for financial calculations. I would not. Item: it is normal for currency conversions to be defined as a mandatory algorithm defined as a set of integer calculations by the network or authority who control the domain that the currency conversion is made in, e.g S.W.I.F.T. These do not work if floating point arithmetic is used and so are non-compliant. > The details are the killer. > Quite. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |