Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: double == double Date: Sat, 15 Oct 2016 10:32:50 -0400 Organization: Aioe.org NNTP Server Lines: 22 Message-ID: References: <8737k0qd38.fsf@golem.phantasia.org> <87zim5es30.fsf@golem.phantasia.org> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:35765 On 10/15/2016 9:13 AM, Eric Sosman wrote: > The scare quotes around "argument" seem appropriate. I attempted > to explain the basis of the simplistic "Don't use ==" advice, hoping > that an informed understanding would trump blind obedience to some > mysterious rule. (Perhaps I was overly optimistic.) > > There are instances (admittedly not many) where floating-point == > is reliable, appropriate, and "safe when used as directed." It seems > to me that someone who can distinguish the safe from the unsafe cases > will be a better programmer than someone who closes his mind and simply > says "Never use ==, it's sometimes dangerous." But I would say that someone that even though a particular use of double == is safe still consider alternatives that are less fragile to break with future code modifications is a better software engineer than those who reason that since they can see it is safe then all future maintainers of the code will understand the issue and keep it safe. Arne