Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!cwi.nl!dik From: dik@cwi.nl (Dik T. Winter) Newsgroups: comp.arch Subject: Re: Is double->int slow? Message-ID: <3698@charon.cwi.nl> Date: 14 Jun 91 00:54:22 GMT References: <1991Jun10.220533.19560@jetsun.weitek.COM> <1991Jun12.014037.26495@cl.cam.ac.uk> Sender: news@cwi.nl Distribution: comp Organization: CWI, Amsterdam Lines: 18 In article <1991Jun12.014037.26495@cl.cam.ac.uk> cet1@cl.cam.ac.uk (C.E. Thompson) writes: > In article cogswell@MEAT.cs.cmu.edu (Bryce Cogswell) writes: > >Double to int conversion on the RS/6000 is done in software, and > >requires 17-39 instructions. > That's mind-bogglingly many. If it doesn't violate any legal nicety, could > you post the details? I do not think it violates any legal nicety. > > The tedious aspect of double->int conversion in software is usually the > range check. After that, with an IEEE754 implemnetation, adding a suitable > constant to move the integer part to the low-order bits of the mantissa and > simulataneously bias by 2**31 does the trick. On the RS6000 the tedious aspect is not the range check, it is the correctly setting of the FP status bits. When running through the code, I do not think it is done very efficiently. -- dik t. winter, cwi, amsterdam, nederland dik@cwi.nl