Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!umich!sharkey!fmsrl7!art-sy!news From: chap@art-sy.detroit.mi.us (j chapman flack) Newsgroups: comp.unix.programmer Subject: Re: comp_t Keywords: Accounting, comp_t, funny floats... Message-ID: <9105060921.aa11316@art-sy.detroit.mi.us> Date: 6 May 91 13:21:37 GMT References: <512@eskimo.celestial.com> Sender: chap@art-sy.detroit.mi.us (j chapman flack) Reply-To: chap@art-sy.detroit.mi.us (j chapman flack) Organization: Appropriate Roles for Technology Lines: 27 In article <512@eskimo.celestial.com> nanook@eskimo.celestial.com (Robert Dinse) writes: >"comp_t", which is packed into an unsigned short (16 bits). The >comments say: > > /* 13-bit fraction, 3-bit exponent */ I just messed with that recently myself. By running a bunch of commands that took known amounts of time (sleep(1) is handy for that) and trying to make sense of the resulting comp_ts, I came up with the following theory: mantissa = comp_t & 0x1FFF exponent = comp_t & 0xE000 double ticks = ldexp( (double)mantissa, 3*exponent) The extra factor of 3 in the exponent bothers me, but it was consistent with the various values I tried. You'll probably want to run a number of trials yourself. I would be delighted, actually, to learn that I'm wrong and have someone provide a more sensible explanation. Wouldn't it be nice if AT&T's comment included the information that needs to be included? -- Chap Flack Their tanks will rust. Our songs will last. chap@art-sy.detroit.mi.us -Mikos Theodorakis Nothing I say represents Appropriate Roles for Technology unless I say it does.