Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mips.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!epsilon!zeta!sabre!petrus!bellcore!decvax!decwrl!Glacier!mips!mash From: mash@mips.UUCP (John Mashey) Newsgroups: net.lang.c Subject: Re: Uses of "float:16" ? Message-ID: <203@mips.UUCP> Date: Sun, 6-Oct-85 14:03:17 EDT Article-I.D.: mips.203 Posted: Sun Oct 6 14:03:17 1985 Date-Received: Tue, 8-Oct-85 04:23:27 EDT References: <486@houxh.UUCP> <2600015@ccvaxa> <238@graffiti.UUCP> <716@sfmag.UUCP> <1841@brl-tgr.ARPA> Organization: MIPS Computer Systems, Mountain View, CA Lines: 31 > > > Then you can define > > > > > > float foo:16; > > > > > > if you really think you can do something useful with 16-bit floats. Someone > > > must use them for something... > > > > Just such a construct is used in the accounting software in many UNIX System > > kernels. It seems to suffice for the application. > > Great, a violation of the C language spec in the kernel. Not to worry. There's no float foo:16 definition per se; what's there is DMR's typedef ushort compt_t; followed by code that does arithmetic in longs, then packs the results into the comp_t, with 3-bit exponent and 13 bit mantissa. This was done because: a) You need more than 16 bits to represent the observed numbers. b) You want both good precsision for smaller numbers, for doing measurement studies, and at least gross precision for larger ones, for system accounting. Good short-float application. c) The process accounting system can generate much data; this was especially a concern on the PDP 11/70s current when this code was written; anything was worth keeping the size down. d) Using the comp_t code lets you keep the size of (struct acct) to 32 bytes. It is moderately helpful that this size be a power of 2 so that the struct never cross disk buffer boundaries. -- -john mashey UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash DDD: 415-960-1200 USPS: MIPS Computer Systems, 1330 Charleston Rd, Mtn View, CA 94043