Path: utzoo!mnetor!uunet!oddjob!hao!ames!sgi!msc From: msc@ramoth.SGI.COM (Mark Callow) Newsgroups: comp.windows.news Subject: Re: NeWS on a SUN, bug in translate? Message-ID: <11843@sgi.SGI.COM> Date: 28 Feb 88 22:45:33 GMT References: <539@modular.UUCP> <2090@natmlab.dms.oz> <1369@vaxb.calgary.UUCP> <1399@vaxb.calgary.UUCP> Sender: daemon@sgi.SGI.COM Distribution: comp Organization: Silicon Graphics Inc, Mountain View, CA Lines: 46 Keywords: NeWS In article <1399@vaxb.calgary.UUCP>, radford@calgary.UUCP (Radford Neal) writes: > In article <11753@sgi.SGI.COM>, msc@ramoth.SGI.COM (Mark Callow) writes: > > > The C routines were only provided as a porting aid. Any vendor who used > > them in a product should be hung out to dry. > > If I have correctly interpreted the tone of this comment, you think my > criticism above was misdirected, overly-picky, pedantic, whatever. > > I am unable to fathom this view. If the C routines were intended as > a "porting aid", surely it is crucial that they perform all the required > functions, albeit slowly. This way, the person rewriting them in > assembler for their machine will actually know what they are supposed > to do... I'm not being overly picky. I simply don't believe the C fract routines should be used in a product. If I remember right the porting guide says this and also warns that they don't check for overflow. They serve as a means to get NeWS up quickly and that is all. I was never in any doubt that they didn't check overflows and I also never had any trouble understanding what they were supposed to do. When I was porting NeWS to the mips, I looked at these C routines and concluded it would be hard to do proper overflow checking in a C language version. I implemented the routines in mips assembler using the 68020 assembler version and the comments in fract.c as a guide. In retrospect, I can see that some judicious comparisons of signs would probably have worked. > > As you appear to be familiar with NeWS source code, you surely aren't > going to claim that the function of these routines is obvious from > the documentation, are you? > The function of the routines is obvious from the function names: frmul, vfrmul, frdiv, vfrdiv etc. The algorithms used are not so obvious but there *are* some helpful comments in fract.c especially in frmul. As I said in my article there are plenty of places that don't check the overflow flag so even when the fract routines are doing the right thing you aren't out of trouble. -- From the TARDIS of Mark Callow msc@sgi.sgi.com, ...{ames,decwrl,sun}!sgi!msc "There is much virtue in a window. It is to a human being as a frame is to a painting, as a proscenium to a play. It strongly defines its content."