Re: What is the FORTRAN for ? (Herman Rubin)
Mon, 30 Jul 90 18:04:39 GMT

          From comp.compilers

Related articles
Re: What is the FORTRAN for ? (1990-07-30)
Re: What is the FORTRAN for ? (Preston Briggs) (1990-07-30)
Re: What is the FORTRAN for ? (1990-07-31)
Re: What is the FORTRAN for ? (Bart Massey) (1990-08-01)
| List of all articles for this month |

Newsgroups: comp.compilers,comp.lang.misc
From: (Herman Rubin)
Keywords: Fortran, design, code
Organization: Purdue University Statistics Department
References: <> <164@kaos.MATH.UCLA.EDU> <>
Date: Mon, 30 Jul 90 18:04:39 GMT

This appeared in an article posted to comp.lang.fortran, and I believe it
illustrates a point about the weaknesses of HLLs (The poster was referring
to C at this point) and compilers.

In article <>, (Richard O'Keefe) writes:

> double nint(double x)
> {
> return ceil(x + 0.5) - (fmod(x*0.5 + 0.25, 1.0) != 0);
> }
> is all it takes.]

I have not checked the code, but this points out what is wrong with the
present HLLs and that compilers cannot be expected to overcome the problem.
If this #define were used, then this block of code would be inserted wherever
this is wanted, even if there is a machine instruction which does the job.

I do not see how a compiler can recognize that the complicated body of code
can be replaced by a single instruction and make that substitution. One
could put that one in, but another will arise, and another. And these will
continue to crop up as long as the language primitives are restricted as
they now are.
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054 (Internet, bitnet) {purdue,pur-ee}!!cik(UUCP)

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.