Xref: utzoo comp.arch:14478 comp.lang.lisp:2882 comp.lang.misc:4364 comp.lang.smalltalk:1746 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!cernvax!chx400!unizh!gorgo!schaerer From: schaerer@gorgo.ifi.unizh.ch Newsgroups: comp.arch,comp.lang.lisp,comp.lang.misc,comp.lang.smalltalk Subject: Re: CORRECTION to: heaps of numbers (tagged immediate floats) Keywords: floating point, garbage collection, tags, IEEE floats, whoops Message-ID: <1990Mar7.165256.28867@gorgo.ifi.unizh.ch> Date: 7 Mar 90 16:52:56 GMT References: <1990Mar5.220724.3718@Neon.Stanford.EDU> <14261@lambda.UUCP> <1990Mar6.015230.20068@Neon.Stanford.EDU> <1990Mar5.221226.4841@hellgate.utah.edu> Organization: University of Zurich, Department of Computer Science Lines: 55 jlg@lambda.UUCP (Jim Giles) writes: > ...A 4 bit exponent only gives an exponent range of about 2^-15 thru > 2^15 - that is, a little more than 10^-5 thru 10^5. wilson@carcoar.Stanford.EDU (Paul Wilson) writes: > Thanks to Carl Lowenstein, Jim Giles and Herman Rubin for pointing out > my misunderstanding of the IEEE float format. I had not realized that > the exponent is really interpreted with a double exponentiation -- that > changes things a bit. (Or maybe two bits.) > > (I seem to recall that the only floating point format I ever had to learn > used a power of a fixed number, and I thought IEEE would be the same.) > > So it looks like each marginal bit would be more important than I thought, > favoring stealing _very_few_ bits from the exponent. 2**(2**4) would > only give you a range of 1/32K to 32K. But 2**(2**5) would give you > a range from 1/2nano- to 2giga- which seems pretty reasonable. And 2**(2**6) > goes from pretty seriously small to pretty seriously big (by my standards). > > I interpret this to mean that I can steal 2 bits from the 8-bit exponent, > leaving 6, or maybe 3, leaving 5. dave@tygra.UUCP (David Conrad) writes: > Well, he said he could use as little as 2 bits, so with 6 bits of > exponent the range should be 2^63 thru 2^-63 or roughly 10^19 thru 10^-19, > probably sufficient for his purposes. Please folks. It's so simple. - With four bits you can represent sixteen values, e.g. -8 to 7. - An exponent between -8 and 7, together with a mantissa between 0.5 and (almost) 1, covers the range 0.5 * 2^-8 to (almost) 2^7. (Assuming that you don't represent denormalized numbers, they don't make sense for the application being discussed.) - Alternatively, an exponent between -7 and 8 would cover 0.5 * 2^-7 to (almost) 2^8. You can fine-tune the range by defining how you interpret the sixteen four-bit-combinations. So, five bits gives approximately 1/64K to 64K. Six bits (not five) gives the nano to giga range. Seven bits gives approximately 10^-19 to 10^19. And eight bits approximately 10^-38 to 10^38, as we all know. Besides, there is no "double exponentiation" involved. The constant "two" is simply raised to the power indicated by the exponent. But having one more exponent bit gives you twice as many possible exponent values: The exponent range is DOUBLED, which means the floating-point number range is SQUARED. But I like Paul Wilson's idea of special-caseing the common values. --- Daniel Schaerer, University of Zurich/Switzerland schaerer@ifi.unizh.ch