Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!ut-emx!perv.pe.utexas.edu!pefv700 From: pefv700@perv.pe.utexas.edu Newsgroups: comp.unix.programmer Subject: Re: comp_t Message-ID: <48596@ut-emx.uucp> Date: 7 May 91 17:03:33 GMT Sender: news@ut-emx.uucp Distribution: usa Organization: Dept. of Petroleum Engineering, The University of Texas at Aust Lines: 27 In article <9105060921.aa11316@art-sy.detroit.mi.us>, chap@art-sy.detroit.mi.us (j chapman flack) writes... >mantissa = comp_t & 0x1FFF >exponent = comp_t & 0xE000 > >double ticks = ldexp( (double)mantissa, 3*exponent) > I would be delighted, actually, to learn that I'm wrong and have >someone provide a more sensible explanation. Try ticks = (double)((comp_t & 0x1fff) << 3 * (comp_t & 0xe000)); The reason your ldexp call is correct is that it is mantissa times (8 to the power exponent) or more literally mantissa times (2 to the power (3 times exponent)) This can be done quicker with a left shift. As K&R2 says, The value of E1<