Path: utzoo!mnetor!tmsoft!torsqnt!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!emory!mephisto!bbn!bbn.com!khoult From: khoult@bbn.com (Kent Hoult) Newsgroups: comp.arch Subject: Re: floating point formats -- usage of small floats Message-ID: <53004@bbn.COM> Date: 5 Mar 90 18:24:33 GMT References: <1990Mar5.031003.12107@Neon.Stanford.EDU> <11298@encore.Encore.COM> Sender: news@bbn.COM Reply-To: khoult@BBN.COM (Kent Hoult) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 35 In article <11298@encore.Encore.COM> jkenton@pinocchio.encore.com (Jeff Kenton) writes: >From article <1990Mar5.031003.12107@Neon.Stanford.EDU>, by wilson@carcoar.Stanford.EDU (Paul Wilson): >> I'm looking for info that would be useful in implementing short >> floating point numbers for Lisp/Smalltalk/etc. >> >> The basic idea is that I want short (1-word) floating point numbers to >> fit in one 32-bit words, *with* a runtime tag included. My plan is > >For each bit of exponent you drop you cut the range in half -- 4 bit exponents >only leave a range of .004 to 511. Each four bits of mantissa you drop will >lose you slightly more than 1 decimal digit. > >Furthermore, anything you do will mean that the FP hardware won't work with >your number format. And, no, you couldn't fake it, truncate it or trick it >to get "approximately right" results from a chain of calculations "most of >the time". Your users would shoot you. Not quite true. I've built a lisp machine where we did exactly this for short floats. Even in a truncated format, they can be very useful for certain things (graphics is one of the best examples). As long as it is clearly document what you lose and gain by using the short format (which is definately not IEEE anymore) there isn't a problem. Users that really want true IEEE will select the IEEE format. But the shorts are good for lots of other stuff. The format we used was to truncate the bottom 6 bits of mantissa and shifted the word right 6 bits. This left room for a 6 bit tag while still having just over 5 decimal digits af accuracy (2^17). Conversion was then trivial in either direction ( short->single is a 6 bit left shift, and single->short is 6 bit right shift and OR in the datatype, plus beware of NAN's). Kent Hoult TEL: (617) 873-4385 ARPA: khoult@bbn.com