Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: 4ndre4 <626401fd-4bc7-4f8f-b641-563ae0f72920@626401fd-4bc7-4f8f-b641-563ae0f72920.invalid> Newsgroups: comp.lang.java.programmer Subject: Re: double == double Date: Sun, 16 Oct 2016 14:06:29 +0100 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <8737k0qd38.fsf@golem.phantasia.org> <87zim5es30.fsf@golem.phantasia.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 16 Oct 2016 13:06:12 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="00669a5be4e262b5e0871dbe545d5d71"; logging-data="14769"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Cb2LcHwZ8G95SNJ3iLH/8" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 In-Reply-To: Cancel-Lock: sha1:ZK6qbc8Brums6KBrCd4zg9H2PD4= Xref: csiph.com comp.lang.java.programmer:35782 On 16/10/2016 13:37, Eric Sosman wrote: [...] > ... and *still* get the wrong answer! You did not get my point. Those subparts have to be converted to *integers* and compared as such, not compared as string. If I know the semantics of a version number, I know how to compare it to another version number. No matter how silly your version format is: if I know that a '@' means newer and '#' means older, than I'll have a version comparator that takes that into account. > That is, plain String comparison is inadequate for checking complete > version numbers See above: plain string comparison is *not* what I am talking about. Again: saying that strings are not a good idea to store dates or versions, just because you cannot compare dates or versions as strings is a flawed argument. If you expect a date in the form dd/mm/yyyy you need a specific comparator. If you expect a version in the form major.minor.update-build, you need a specific comparator. Let me remind you that the original argument was: "I don't think that double nor String are good choices for version numbers" That's illogical. Strings are a good choice for version numbers as well as they are for dates. -- 4ndre4