msb@sq.UUCP (04/07/87)
> 2. Kernighan and Plauger, in _The_Elements_of_Programming_Style_, note that > the version of fortran at their local installation fails on an equality test > when one number is on an input punch-card and the other, identically typed > and also a constant, is in a program. This is because different scanning > routines were used in the i/o library compiled with the fortran program and > the i/o routines that were part of the fortran compiler! So much for > floating-point equality in fortran. This is misremembered. The reference is to the fact that in a Fortran PROGRAM, blanks are ignored (except in quoted or counted character strings); whereas in Fortran formatted DATA, blanks are taken as zeros. Thus the code READ (5, 5) I 5 FORMAT (I5) IF (I .EQ. 1 024) CALL X with the data 1 024 will compare 1024 to 10024 and so X will not be called. This is not a matter of implementations or libraries, and has nothing to do with floating point; it is simply a (mis)feature of the language (or used to be, I'm not up on modern Fortranities). Speaking of Fortranities, this seems a good time to point people to the April 1984 issue of Communications of the ACM. This issue includes a "Special Section", edited by Peter Neumann of (mod.)Risks fame. Although presented deadpan, the section consists of excellent humor articles, one of which is a send-up of Fortran... I'm glad the author didn't take on C... Mark Brader "You wake me up early in the morning to tell me I am utzoo!sq!msb right? Please wait until I am wrong." -- John von Neumann, on being phoned at 10 am