From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org Tue Oct 28 04:04:31 2014 Return-Path: X-Original-To: sc22wg5-dom8 Delivered-To: sc22wg5-dom8@www.open-std.org Received: by www.open-std.org (Postfix, from userid 521) id 9FDE13587AB; Tue, 28 Oct 2014 04:04:31 +0100 (CET) Delivered-To: sc22wg5@open-std.org Received: from mail.jpl.nasa.gov (mailhost.jpl.nasa.gov [128.149.139.106]) by www.open-std.org (Postfix) with ESMTP id E71E4358762 for ; Tue, 28 Oct 2014 04:04:27 +0100 (CET) Received: from [137.79.7.57] (math.jpl.nasa.gov [137.79.7.57]) by smtp.jpl.nasa.gov (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id s9S34LKV004166 (using TLSv1/SSLv3 with cipher DHE-RSA-AES128-SHA (128 bits) verified NO); Mon, 27 Oct 2014 20:04:24 -0700 Subject: Re: (j3.2006) (SC22WG5.5351) [ukfortran] From a colleague From: Van Snyder Reply-To: Van.Snyder@jpl.nasa.gov To: fortran standards email list for J3 Cc: WG5 In-Reply-To: <20141028005636.2C7383587BC@www.open-std.org> References: <20141027201943.09E1A3582F9@www.open-std.org> <20141028005636.2C7383587BC@www.open-std.org> Content-Type: text/plain; charset="ISO-8859-1" Organization: Yes Date: Mon, 27 Oct 2014 20:04:21 -0700 Message-ID: <1414465461.3703.159.camel@math.jpl.nasa.gov> Mime-Version: 1.0 X-Mailer: Evolution 2.32.3 (2.32.3-30.el6) Content-Transfer-Encoding: 7bit X-Source-Sender: Van.Snyder@jpl.nasa.gov X-AUTH: Authorized Sender: owner-sc22wg5@open-std.org Precedence: bulk The problem illustrates that Fortran codes have extremely long lives. The codes containing arithmetic IF were written before IEEE arithmetic existed. They were developed and supported on a shoestring for more than thirty years, and then support was discontinued entirely in 1996. My colleague is the sole proprietor of this software. It will almost certainly be left to anybody who is still using this software to retrofit the arithmetic IF statements to something else, including detecting NaN. We have five pages of processor dependencies. Can we keep arithmetic IF, and define the result when is NaN to be processor dependent? I agree arithmetic IF shouldn't be used NOW, but giving the advice that "you should never use it" requires the owner of fifty-year-old code (that works extremely well) to have a time machine to return to 1966 and advise against it. On Tue, 2014-10-28 at 09:56 +0900, Malcolm Cohen wrote: > This discussion seems to be continuing on the J3 list, but for everyone else... > > >My colleague wrote: > > > > I've just learned that at least some compilers will no longer > > support the arithmetic IF statement. > > Since that is currently standard-conforming, such a compiler is also not > standard-conforming. Compilers that ignore the standard are (rather obviously) > not going to be affected by whatever *we* decide! > > > The reason being that > > there is no good answer as to what this statement should do if > > the value in question is a NaN. > > I suspect your colleague is labouring under a misapprehension. > > There is, indeed, no good answer as to what this statement should do if the > value in question is a NaN. Which is why you should remove it from your > program. And why it should be removed from the standard. > > That does not mean that any compiler will actually rip out its support for the > (broken!) feature. > > > And here I thought that > > compiler writers would continue to support all the old features > > out of self interest. But here there seems to be no good > > answer. > > Compilers will "support" it, but you should never use it. > > >This colleague has "only" about 170,000 lines of Fortran 77 > > Right, and arithmetic IF is a Fortran 66 feature that is redundant with Fortran > 77, therefore we are talking 2014-1978 = it has been obsolete for 36 years and > formally marked as obsolescent for 2014-1991=23 years. > > I don't see why the standard should support broken features that were obsolete > for virtually the entire working lifetime of all current programmers. > > Anyway, if NaN's are not an issue (either because you've proved some difficult > mathematical theorems about your code, you have some sophisticated error > handling mechanism, you are running with the Invalid Exception trap enabled, or > you don't care if the bridge falls down/plane falls out of the sky), it is > trivial to replace arithmetic IF with newer alternatives. > > After all, if you continue to use arithmetic IF, that's what the compiler is > effectively going to do "under the covers". There are no single machine > instructions that branch to three different labels depending on a floating-point > value. Of course this means that NaN will do different (and maybe impossible) > things on different machines or with different compiler options. Now THAT would > be a problem! At least if you replace it with 1-3 logical IF+GOTO yourself it > will do the same thing. > > > code to > >support. He's a semi-retired proprietor of a small business, with no > >staff other than himself to revise his codes so as not to use Arithmetic > >IF. > > If he doesn't know what his code should do with a NaN, I don't see how it is any > fault of the language or the compiler! > > >Was it really wise, and especially was it necessary, to delete > >Arithemtic IF? > > Yes, and yes. > > Cheers,