Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: glen herrmannsfeldt Newsgroups: comp.lang.java.programmer Subject: Re: Sorting numeric strings Date: Mon, 7 May 2012 17:48:55 +0000 (UTC) Organization: Aioe.org NNTP Server Lines: 16 Message-ID: References: <3s93q719q1787gb4ihi4fugvn8cvgc8nu2@4ax.com> <29053378.63.1336093904131.JavaMail.geo-discussion-forums@pbctc10> NNTP-Posting-Host: H0vc4U5LIRkRHNPyGCs2dA.user.speranza.aioe.org X-Complaints-To: abuse@aioe.org User-Agent: tin/1.9.6-20100522 ("Lochruan") (UNIX) (Linux/2.6.32-5-amd64 (x86_64)) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:14374 Gene Wirchenko wrote: (snip) > Floating point can represent some integer values exactly. The > IEEE 754 64-bit format has 53 bits of precision. This is not quite 16 > digits of precision. Stick with integer values in the range > (-10^15,10^15) (an exclusive range), and they will all be represented > exactly. I believe that addition, subtraction, and multiplication should give the right answer as long as it stays within range. Divide is less obvious. Are you sure that there are no cases where divide will round incorrectly? -- glen