Float bug toolkit: what the hash is this?

Bruce Cohen cohenb at gemstone.com
Thu Feb 19 19:33:11 UTC 1998


"Christopher Oliver" <oliver at fritz.co.traverse.com> wrote:
>> Thanks.  I think this is what David was hinting at, and it's indeed
>> what I was trying to get at in my amateurish way.  Given that the
>> problem arises out of the use of hash on floats, I find myself asking
>> if there are really any reasons to hash floats since this implies
>> a equality search for an unknown float in some table.  We're getting
>> precariously close to what McCarthy might have called pornographic
>> programming.

Well, maybe just titilating :-).  The only time I've needed to search
floats was when I was designing a Collection that was intended to allow
imprecise search for the value of a time-varying function (specifically,
a voltage waveform, which might let you guess who I worked for at the
time).  The solution I came up with was a Dictionary whose key was a Float, and
whose value was the voltage measured at the point in time beginning with
the key.  The implicit assumption was that the value would be the same
for all times in the half-open interval between the key and the next key
in sequence.  For this situation using hash works fine, because the key
values stand in for intervals, and any calculations used to generate a
time for lookup can take that into account.
-----------------------------------------------------------------------------
"A polar bear is a rectangular bear after a coordinate transform." - anon.
-----------------------------------------------------------------------------
Bruce Cohen,                               |  email: cohenb at gemstone.com
GemStone Systems, Inc.                     |  phone: (503)533-3602
20575 NW Von Neumann Drive                 |  fax:   (503)629-8556
Beaverton, OR USA 97006                    |  web:   http://www.gemstone.com





More information about the Squeak-dev mailing list