Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 01 May 2012 17:02:07 -0500 Date: Tue, 01 May 2012 15:02:09 -0700 From: Patricia Shanahan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: Sorting numeric strings References: <2012043021273098748-no@waycom> <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com> In-Reply-To: <0km0q7lrv910pkbfb1lidbdfr3bkfjglui@4ax.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 18 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 70.230.201.141 X-Trace: sv3-LKqrUcSi6WkSfwbZxNTX/rB4S0mJjwqXiWN3fOJOAcjpghDzZsik3bVrH/pci/+ro2OHbyfKPAZ3Qux!23IAFN6nWMdGdJ5Vhewvvv+9+a4GOUFBwRw0RVj1lPpLgK18Jljue5tAtZy7KmtK3V1ZNW/OC/pq!B3u2FRnXDHfTmcaalvagvDAwtAEe5QREBMiJRKYbg1y28BE= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1829 Xref: csiph.com comp.lang.java.programmer:14104 On 5/1/2012 2:50 PM, Roedy Green wrote: > On Tue, 01 May 2012 10:53:35 -0700, Daniel Pitts > wrote, quoted or indirectly > quoted someone who said : > >> >> In order to compare two strings as numbers, you need to pad zeros on >> both extremes away from any "dot". > > the other way is with Double.parseDouble and compare the doubles. Whether comparing doubles gives the correct result does depend on the maximum number of significant digits. BigDecimal is always safe for this, no matter how many significant digits. Patricia