On Fri, Jul 30, 2010 at 11:55 AM, Martin McClure <[email protected]>wrote:
> On 07/30/2010 11:28 AM, Eliot Miranda wrote: > > [...] > > > >> Excellent!! Just by curious, your idea, or what you did in VW, was >> to be able to put SmallFloats directly inside the address ? just >> like we do nowadays with SmallInteger ? >> >> >> Yes. The scheme provides IEEE double precision but with a smaller >> exponent so the range is the same as the 32-bit single-precision range. >> i.e. 3 bits are used as tag bits to distinguish SmallInteger >> SmallFloat Character and objects. That leaves 1 bit for sign, 52 bits >> for the mantissa and 8 bits for the exponent. The use of 3 tag bits >> comes from 64-bit pointers being 8-byte aligned and so having the least >> significant 3 bits 0. I don't want to defend that choice now just to >> give you a flavour of the representation: >> >> | 8-bit exponent | 52 bit mantissa | sign | tags | >> > > A few more words on the VW SmallDouble implementation: We also use this > representation in GemStone; it works very well. > > This representation exactly represents a subset of the possible IEEE > doubles. It's the "common" 1/8th of the total range, with the addition of > +-0.0. Non-zero numbers very close to zero or very far from zero overflow to > normal Float objects in a manner very similar to the way > SmallInteger/LargeInteger work. The infinities and NaNs also must be > represented as normal Floats. > > Because between SmallDouble and Float all IEEE doubles can be represented, > all floating-point computations give the correct (per IEEE) result, but you > save memory and computation is generally faster because you don't access as > many bytes in main memory. > and I should say that while I came up with the scheme it was Martin who very patiently debugged it. Without Martin's help it would have been a train wreck. Thanks again, Martin! > Regards, > > -Martin >
_______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
