Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!purdue!ames!uhccux!virtue!comp.vuw.ac.nz!munnari.oz.au!mudla!ok From: ok@mudla.cs.mu.OZ.AU (Richard O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: What is the FORTRAN for ? Keywords: FORTRAN, stupidity Message-ID: <4922@munnari.oz.au> Date: 27 Jul 90 12:43:29 GMT References: <1990Jul25.174153.16896@ecn.purdue.edu> <164@kaos.MATH.UCLA.EDU> Sender: news@cs.mu.oz.au Lines: 38 On the whole, I'd like to defend Fortran against Pascal/C/you-name-it bigots, but I couldn't resist this. In article <164@kaos.MATH.UCLA.EDU>, pmontgom@euphemia.math.ucla.edu (Peter Montgomery) writes: > What other common languages support all four rounding modes, and allow you to > mix them in one expression, as in > i = CEIL(TAN(x)) - NINT(SQRT(y)) ? (a) Common Lisp: (setq i (- (ceiling (tan x)) (round (sqrt y)) )) [Oops. Common Lisp *does* support four rounding modes: round towards plus infinity (ceiling) round towards minus infinity (floor) round towards zero (truncate) round to nearest/even on tie (round) According to "Fortran 8X explained", NINT should be (round), but one F77 document I've seen claims that NINT is (roughly) NINT(X) = ISIGN(X)*CEIL(IABS(X)) which rather surprised me. I'm assuming that it's round to nearest.] (b) C: i = ceil(tan(x)) - nint(sqrt(y)); [Ok, only floor(), ceil(), and truncation are defined in the standard, but nint() is available in _some_ Cs. If it isn't, double nint(double x) { return ceil(x + 0.5) - (fmod(x*0.5 + 0.25, 1.0) != 0); } is all it takes.] I would point out that I was very surprised once when I discovered just how few of the things I thought of as F77 intrinsics were actually in the standard. (ERF doesn't seem to be in F90.)