Shouldn't 2 hash = 2.0 hash? [LONG]

David N. Smith (IBM) dnsmith at watson.ibm.com
Mon Nov 29 23:29:59 UTC 1999


At 17:41 -0500 11/29/99, agree at carltonfields.com wrote:
>... SNIP ...
>
>Just out of curiousity, is there any real reason why Floats with 
>integer truncations shouldn't hash to the same value as their 
>integer counterparts?  How much slower would that really be?

Well, on the surface it wouldn't seem too hard:

     Float>>hash
       self fractionPart = 0.0 ifTrue: [
          ^ self integerPart asInteger hash ].
       " drop thru to existing code "

I recall that the current Float>>hash was a temporary method anyhow, 
and that I have a better one (larger range) somewhere. Maybe it is 
time to get that back out and see about making this change?

Dave
_______________________________
David N. Smith
IBM T J Watson Research Center
Hawthorne, NY
_______________________________
Any opinions or recommendations
herein are those of the author
and not of his employer.





More information about the Squeak-dev mailing list