Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!rochester!pt.cs.cmu.edu!o.gp.cs.cmu.edu!ram From: ram+@cs.cmu.edu (Rob MacLachlan) Newsgroups: comp.arch Subject: Re: Compilers and efficiency Message-ID: <1991Apr9.000144.27650@cs.cmu.edu> Date: 9 Apr 91 00:01:44 GMT References: <27fa3350.6bc2@petunia.CalPoly.EDU> <1991Apr5.172533.6717@agate.berkeley.edu> <9782@mentor.cc.purdue.edu> Sender: netnews@cs.cmu.edu (USENET News Group Software) Organization: School of Computer Science, Carnegie Mellon Lines: 24 >From: hrubin@pop.stat.purdue.edu (Herman Rubin) >Subject: Compilers and efficiency >Date: 7 Apr 91 19:04:12 GMT > >For example, suppose there was an instruction, which could be effectively >used, which would divide a float by a float, obtaining an integer quotient >and a float remainder. Now just how is the compiler to recognize that this >is in fact wanted? > >There is, at present, no language designed to take into account the collection >of "natural" useful hardware which the present users can find uses for, and >which are far more expensive in software than in hardware. Well, in Common Lisp, (truncate 4.5 2.0) returns 2 (an integer) and .5 (a float). And you can use CEILING, FLOOR or ROUND to get rounding to +inf, -inf or nearest. The Common Lisp numeric support was designed by someone with a pretty good understanding of numerical analysis, and of the IEEE float standard. [Guy Steele, I believe...] Unfortunately, most Common Lisp implementations don't implement numeric stuff well enough to be worth using. In my work on CMU Common Lisp, I have made some major improvements in basic efficiency, but nobody has yet realized the full potential of numbers in Common Lisp. Rob