Path: utzoo!attcan!uunet!husc6!mailrus!cornell!uw-beaver!teknowledge-vaxc!sri-unix!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: Fortran vs C for computations Message-ID: <362@quintus.UUCP> Date: 7 Sep 88 09:51:02 GMT References: <1443@valhalla.ee.rochester.edu> <3256@lanl.gov> Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Organization: Quintus Computer Systems, Inc. Lines: 38 In article <3256@lanl.gov> jlg@lanl.gov (Jim Giles) writes: >From article <1443@valhalla.ee.rochester.edu>, by davis@galaxy.ee.rochester.edu (Al Davis): [[ in response to a statement that Fortran is better than C for numerical work because sqrt() can be trapped in Fortran but not in C, that it *can* be done in C, with matherr(). ]] >Anything C can do portably with library routines, Fortran can also do >portably with library routines. I would like to see a more convincing proof of this. >Just because you haven't seen a Fortran >compiler that does X, doesn't mean X can't be done with Fortran. But the topic was not what *could* be done, but what *HAS* been done. There are numerous Fortran processors which provide means of trapping or ignoring floating-point exceptions. Trouble is, they don't do it the same way. [I checked the IBM SAA FORTRAN Reference manual, but evidently MVS Fortran and OS/2 Fortran do not have a common form of numeric exception handling.] - (pre-ANSI) C has matherr() and signal(SIGFPE, ...), though the draft ANSI standard doesn't contain matherr(). - ADA [LRM 11.1, 4.5.7] doesn't require that an implementation detect or signal numeric errors, but it _does_ provide a standardised way of catching them if they are detected and signalled. - COBOL has had the "ON OVERFLOW user-action" clause for catching fixed-point overflow for decades. - PL/I has the ([NO]{OVERFLOW,UNDERFLOW,...}): condition prefixes and the ON {OVERFLOW,UNDERFLOW,...} statement. How come _the_ language for floating-point calculations doesn't have a portable way of catching or suppressing floating-point exceptions? Bitwise operations and a WHILE loops are covered in a supplementary MIL-STD for Fortran; is there also some supplementary standard which supplements Fortran with this facility?