home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!cs.utexas.edu!convex!convex!dodson
- From: Dave Dodson <dodson@convex.COM>
- Subject: Re: hashing floating-point numbers
- Originator: dodson@bach.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Message-ID: <1993Jan25.161901.5233@news.eng.convex.com>
- Date: Mon, 25 Jan 1993 16:19:01 GMT
- Reply-To: dodson@convex.COM (Dave Dodson)
- References: <1993Jan22.175723.17245@chpc.utexas.edu>
- Nntp-Posting-Host: bach.convex.com
- Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 24
-
- In article <1993Jan22.175723.17245@chpc.utexas.edu> pefv700@chpc.utexas.edu (Christopher Phillips) writes:
- >What are the usual methods for hashing floating-point numbers
- >given that numbers "equivalent" to a certain precision should
- >hash to the same value?
-
- I don't think you have specified the problem well. Suppose you have
- chosen a certain tolerance, epsilon, such that if x and y differ in
- magnitude by less than epsilon ( abs(x-y) < epsilon ) then they hash
- to the same value. Now suppose that you have x, y, and z such that
- x < y and y < z, but y-x < epsilon and z-y < epsilon. Then x and y
- have to hash to the same value, and y and z have to hash to the same
- value, so x and z have to hash to the same value, even if z-x > epsilon.
-
- Now, given any two floating point numbers, w and y, with w < y, you can
- construct a net of values w < x1 < x2 < ... < xn < y, with each adjacent
- pair differing by less than epsilon. Then w hashes to the same value as
- x1, which hashes to the same value as x2, ..., which hashes to the same
- value as y. So w and y hash to the same value for every w and y. This
- does not sound useful.
-
- ----------------------------------------------------------------------
-
- Dave Dodson dodson@convex.COM
- Convex Computer Corporation Richardson, Texas (214) 497-4234
-